-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214 from primer/image-container-component
Create ImageContainer component
- Loading branch information
Showing
7 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/gatsby-theme-doctocat": minor | ||
--- | ||
|
||
Add ImageContainer component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
title: ImageContainer | ||
status: New | ||
source: https://github.com/primer/doctocat/blob/master/theme/src/components/image-container.js | ||
--- | ||
|
||
Use the `ImageContainer` component to contain images in documentation pages. | ||
|
||
## Usage | ||
|
||
`ImageContainer` is a [shortcode](https://mdxjs.com/blog/shortcodes), meaning it's globally available in all `.md` and `.mdx` files. So you can use the `ImageContainer` component in any `.md` or `.mdx` file without importing it. | ||
|
||
```jsx live | ||
<ImageContainer> | ||
<img | ||
width="290" | ||
src="https://user-images.githubusercontent.com/4608155/104243682-cc166c00-5415-11eb-889b-9abe9997481a.png" | ||
alt="Star and Unstar buttons" | ||
/> | ||
</ImageContainer> | ||
<Caption>Star and Unstar buttons</Caption> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {BorderBox, Flex} from '@primer/components' | ||
import React from 'react' | ||
|
||
function ImageContainer({children}) { | ||
return ( | ||
<BorderBox p={6} bg="gray.1"> | ||
<Flex justifyContent="center" sx={{img: {maxWidth: '100%'}}}> | ||
{children} | ||
</Flex> | ||
</BorderBox> | ||
) | ||
} | ||
|
||
export default ImageContainer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a5db911
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
gatsby-theme-primer-example – ./
gatsby-theme-primer-example-git-master.primer.now.sh
gatsby-theme-primer-example.primer.vercel.app
doctocat.now.sh
gatsby-theme-primer-example.primer.now.sh
gatsby-theme-primer-example-git-master.primer.vercel.app
a5db911
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
doctocat – ./
doctocat.now.sh
doctocat-git-master.primer.vercel.app
doctocat.primer.vercel.app
doctocat.primer.now.sh
doctocat-git-master.primer.now.sh