Files
react/pages/docs/components/code.mdx
2020-03-23 09:35:01 +08:00

58 lines
1.3 KiB
Plaintext

import { Layout, Playground, Attributes } from 'lib/components'
import { Code } from 'components'
export const meta = {
title: 'Code',
description: 'tenotext',
}
## Code
<Playground
title="Basic"
scope={{ Code }}
code={`
<p>Run <Code>npm i @zeit-ui/react</Code> to install.</p>
`} />
<Playground
title="Bash"
scope={{ Code }}
code={`
<Code bash>yarn add @zeit-ui/vue</Code>
`} />
<Playground
title="Dark Bash"
scope={{ Code }}
code={`
<Code darkBash>yarn add @zeit-ui/vue</Code>
`} />
<Playground
title="Code Block"
scope={{ Code }}
code={`
() => {
const codes = \`npm i @zeit-ui/vue
yarn add @zeit-ui/vue\`
return <Code block>{codes}</Code>
}
`} />
<Attributes edit="/pages/docs/components/code.mdx">
<Attributes.Title>Code.Props</Attributes.Title>
| Attribute | Description | Type | Accepted values | Default
| ---------- | ---------- | ---- | -------------- | ------ |
| **bash** | show code in bash mode | `boolean` | - | `false` |
| **block** | show code in `pre` | `boolean` | - | `false` |
| **darkBash** | show code in darkBash mode | `boolean` | - | `false` |
| **width** | set CSS width | `string` | - | `initial` |
| ... | native props | `HTMLAttributes` | `'className', ...` | - |
</Attributes>
export default ({ children }) => <Layout meta={meta}>{children}</Layout>