|
| 1 | +import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs'; |
| 2 | +import { DescriptionList, Dt, Dd } from '@/polaris-vue'; |
| 3 | +import dedent from 'ts-dedent'; |
| 4 | + |
| 5 | +<Meta |
| 6 | + title="Components / Lists and tables / Description List" |
| 7 | + component={ DescriptionList } |
| 8 | + argTypes={{ |
| 9 | + default: { |
| 10 | + table: { |
| 11 | + disable: true, |
| 12 | + }, |
| 13 | + }, |
| 14 | + }} |
| 15 | +/> |
| 16 | + |
| 17 | +export const Template = (args) => ({ |
| 18 | + components: { DescriptionList, Dt, Dd }, |
| 19 | + setup() { return { args }; }, |
| 20 | + template: `<DescriptionList v-bind="args"> |
| 21 | + <Dt>Logistics</Dt> |
| 22 | + <Dd> |
| 23 | + The management of products or other resources as they travel between a point of origin and a destination. |
| 24 | + </Dd> |
| 25 | + <Dt>Sole proprietorship</Dt> |
| 26 | + <Dd> |
| 27 | + A business structure where a single individual both owns and runs the company. |
| 28 | + </Dd> |
| 29 | + <Dt>Discount code</Dt> |
| 30 | + <Dd> |
| 31 | + A series of numbers and/or letters that an online shopper may enter at checkout to get a discount or special offer. |
| 32 | + </Dd> |
| 33 | + </DescriptionList>`, |
| 34 | +}); |
| 35 | + |
| 36 | +# Description List |
| 37 | + |
| 38 | +Description lists are a way to organize and explain related information. |
| 39 | +They're particularly useful when you need to list and define terms such as in a glossary. |
| 40 | + |
| 41 | +<font color="#FF7900"><strong>Warning:</strong></font> Use component name as case-sensitive (<code><Dt></code> & <code><Dd></code>) to prevent conflict with <code><dt></code> <code><dd></code> HTML element. |
| 42 | + |
| 43 | +<Canvas> |
| 44 | + <Story |
| 45 | + name="Description List" |
| 46 | + height="60px" |
| 47 | + parameters={{ |
| 48 | + docs: { |
| 49 | + source: { |
| 50 | + code: dedent` |
| 51 | + <DescriptionList> |
| 52 | + <Dt>Logistics</Dt> |
| 53 | + <Dd> |
| 54 | + The management of products or other resources as they travel between a point of origin and a destination. |
| 55 | + </Dd> |
| 56 | + <Dt>Sole proprietorship</Dt> |
| 57 | + <Dd> |
| 58 | + A business structure where a single individual both owns and runs the company. |
| 59 | + </Dd> |
| 60 | + <Dt>Discount code</Dt> |
| 61 | + <Dd> |
| 62 | + A series of numbers and/or letters that an online shopper may enter at checkout to get a discount or special offer. |
| 63 | + </Dd> |
| 64 | + </DescriptionList> |
| 65 | + `, |
| 66 | + }, |
| 67 | + }, |
| 68 | + }} |
| 69 | + > |
| 70 | + {Template.bind({})} |
| 71 | + </Story> |
| 72 | +</Canvas> |
| 73 | + |
| 74 | +<ArgsTable story="Description List" /> |
0 commit comments