docs(snippet): add enum type of APIs

This commit is contained in:
unix
2020-06-24 21:01:23 +08:00
parent ddef106e61
commit 7daf3f7465
2 changed files with 34 additions and 19 deletions

View File

@@ -100,17 +100,17 @@ Display a snippet of copyable code for the command line.
<Attributes edit="/pages/en-us/components/snippet.mdx">
<Attributes.Title>Snippet.Props</Attributes.Title>
| Attribute | Description | Type | Accepted values | Default |
| ------------- | ----------------------- | ----------------------------- | ------------------------------------------------------- | ---------------------- |
| **text** | code snippet | `string` `Array<string>` | - | - |
| **type** | snippet types | [SnippetTypes](#snippettypes) | [SnippetTypes](#snippettypes) | `default` |
| **filled** | filled style | `boolean` | - | `false` |
| **width** | set CSS string | `string` | - | `initial` |
| **copy** | function of copy button | `CopyTypes` | `'default', 'slient', 'prevent'` | `default` |
| **symbol** | symbol snippet | `string` | - | `$` |
| **toastText** | toast text | `string` | - | `Copied to clipboard!` |
| **toastType** | toast type | `NormalTypes` | `'default', 'secondary', 'success', 'warning', 'error'` | `success` |
| ... | native props | `HTMLAttributes` | `'id', 'name', 'className', ...` | - |
| Attribute | Description | Type | Accepted values | Default |
| ------------- | ----------------------- | ----------------------------- | -------------------------------- | ---------------------- |
| **text** | code snippet | `string` `Array<string>` | - | - |
| **type** | snippet types | [SnippetTypes](#snippettypes) | [SnippetTypes](#snippettypes) | `default` |
| **filled** | filled style | `boolean` | - | `false` |
| **width** | set CSS string | `string` | - | `initial` |
| **copy** | function of copy button | `CopyTypes` | `'default', 'slient', 'prevent'` | `default` |
| **symbol** | symbol snippet | `string` | - | `$` |
| **toastText** | toast text | `string` | - | `Copied to clipboard!` |
| **toastType** | toast type | `NormalTypes` | [NormalTypes](#normaltypes) | `success` |
| ... | native props | `HTMLAttributes` | `'id', 'name', 'className', ...` | - |
<Attributes.Title>SnippetTypes</Attributes.Title>
@@ -118,6 +118,12 @@ Display a snippet of copyable code for the command line.
type SnippetTypes = 'default' | 'secondary' | 'success' | 'warning' | 'error' | 'dark' | 'lite'
```
<Attributes.Title>NormalTypes</Attributes.Title>
```ts
type NormalTypes = 'default' | 'secondary' | 'success' | 'warning' | 'error'
```
</Attributes>
export default ({ children }) => <Layout meta={meta}>{children}</Layout>

View File

@@ -84,14 +84,17 @@ export const meta = {
<Attributes edit="/pages/zh-cn/components/snippet.mdx">
<Attributes.Title>Snippet.Props</Attributes.Title>
| 属性 | 描述 | 类型 | 推荐值 | 默认 |
| ---------- | ------------------ | ----------------------------- | -------------------------------- | --------- |
| **text** | 命令文本 | `string` `Array<string>` | - | - |
| **type** | 组件类型 | [SnippetTypes](#snippettypes) | [SnippetTypes](#snippettypes) | `default` |
| **filled** | 填充风格的样式 | `boolean` | - | `false` |
| **width** | 设置 CSS 宽度 | `string` | - | `initial` |
| **copy** | 拷贝按钮的工作方式 | `CopyTypes` | `'default', 'slient', 'prevent'` | `default` |
| ... | 原生属性 | `HTMLAttributes` | `'id', 'name', 'className', ...` | - |
| 属性 | 描述 | 类型 | 推荐值 | 默认 |
| ------------- | ------------------ | ----------------------------- | -------------------------------- | ---------------------- |
| **text** | 命令文本 | `string` `Array<string>` | - | - |
| **type** | 组件类型 | [SnippetTypes](#snippettypes) | [SnippetTypes](#snippettypes) | `default` |
| **filled** | 填充风格的样式 | `boolean` | - | `false` |
| **width** | 设置 CSS 宽度 | `string` | - | `initial` |
| **copy** | 拷贝按钮的工作方式 | `CopyTypes` | `'default', 'slient', 'prevent'` | `default` |
| **symbol** | 组件左侧显示的字符 | `string` | - | `$` |
| **toastText** | 拷贝提示的字符 | `string` | - | `Copied to clipboard!` |
| **toastType** | 拷贝提示的类型 | `NormalTypes` | [NormalTypes](#normaltypes) | `success` |
| ... | 原生属性 | `HTMLAttributes` | `'id', 'name', 'className', ...` | - |
<Attributes.Title>SnippetTypes</Attributes.Title>
@@ -99,6 +102,12 @@ export const meta = {
type SnippetTypes = 'default' | 'secondary' | 'success' | 'warning' | 'error' | 'dark' | 'lite'
```
<Attributes.Title>NormalTypes</Attributes.Title>
```ts
type NormalTypes = 'default' | 'secondary' | 'success' | 'warning' | 'error'
```
</Attributes>
export default ({ children }) => <Layout meta={meta}>{children}</Layout>