diff --git a/docs/content/components/do-dont.mdx b/docs/content/components/do-dont.mdx new file mode 100644 index 00000000..44f01de9 --- /dev/null +++ b/docs/content/components/do-dont.mdx @@ -0,0 +1,46 @@ +--- +title: Do/Dont +--- + +The `Do` and `Dont` components are used for providing good and bad examples within documentation. + +## Usage + +To use these components in your MDX files, import them like so: + +```js +import {Do, Dont} from '@primer/gatsby-theme-doctocat' +``` + +If you plan to create side-by-side Do/Don't examples, you'll also want to import the `Grid` component from `@primer/components`: + +```js +import {Grid} from '@primer/components' +``` + +### Side-by-side + +To create a side-by-side Do/Don't example, you can wrap the `Do` and `Dont` components with the `Grid` component: + +```jsx live + + + Use brief and direct communication + + + Don't use wordy and redundant copy + + +``` + +_Note: Caption text should describe the image and be able to stand on its own._ + +### Isolation + +The `Do` and `Dont` components don't always have to be used together. Here's an example of how you might use the `Do` component in isolation: + +```jsx live + + Use a container class to give the text a max-width + +``` diff --git a/docs/src/@primer/gatsby-theme-doctocat/live-code-scope.js b/docs/src/@primer/gatsby-theme-doctocat/live-code-scope.js index b2f4ef7f..1c6c7290 100644 --- a/docs/src/@primer/gatsby-theme-doctocat/live-code-scope.js +++ b/docs/src/@primer/gatsby-theme-doctocat/live-code-scope.js @@ -1,4 +1,4 @@ import * as components from '@primer/components' -import {Hero, Caption} from '@primer/gatsby-theme-doctocat' +import {Hero, Caption, Do, Dont} from '@primer/gatsby-theme-doctocat' -export default {...components, Hero, Caption} +export default {...components, Hero, Caption, Do, Dont} diff --git a/docs/src/@primer/gatsby-theme-doctocat/nav.yml b/docs/src/@primer/gatsby-theme-doctocat/nav.yml index a57e5ab3..a232581e 100644 --- a/docs/src/@primer/gatsby-theme-doctocat/nav.yml +++ b/docs/src/@primer/gatsby-theme-doctocat/nav.yml @@ -19,6 +19,7 @@ children: - title: Caption url: /components/caption - + - title: Do/Dont + url: /components/do-dont - title: Contributing url: /contributing diff --git a/theme/index.js b/theme/index.js index c202ddf3..807196e5 100644 --- a/theme/index.js +++ b/theme/index.js @@ -1,4 +1,5 @@ export {default as Caption} from './src/components/caption' +export {Do, Dont} from './src/components/do-dont' export {default as Container} from './src/components/container' export {default as Head} from './src/components/head' export {default as Header} from './src/components/header' diff --git a/theme/src/components/caption.js b/theme/src/components/caption.js index 85c33779..c4692433 100644 --- a/theme/src/components/caption.js +++ b/theme/src/components/caption.js @@ -1,6 +1,8 @@ import {Text} from '@primer/components' import React from 'react' -const Caption = (props) => +function Caption(props) { + return +} export default Caption diff --git a/theme/src/components/do-dont.js b/theme/src/components/do-dont.js new file mode 100644 index 00000000..c4786f39 --- /dev/null +++ b/theme/src/components/do-dont.js @@ -0,0 +1,48 @@ +import {CircleOcticon, Flex, Text} from '@primer/components' +import {Check, X} from '@primer/octicons-react' +import React from 'react' +import Caption from './caption' + +export function Do({src, children}) { + return ( + + + + + Do + + + + {children} + + ) +} + +export function Dont({src, children}) { + return ( + + + + + Don't + + + + {children} + + ) +}