|
| 1 | +import Changelog from '@twilio-paste/{{kebabCase component-name}}/CHANGELOG.md'; // I don't know why this is needed but if you remove it the page fails to render |
| 2 | +import packageJson from '@twilio-paste/{{kebabCase component-name}}/package.json'; |
| 3 | + |
| 4 | +import {SidebarCategoryRoutes} from '../../../constants'; |
| 5 | +import ComponentPageLayout from '../../../layouts/ComponentPageLayout'; |
| 6 | +import {getFeature, getNavigationData, getComponentApi} from '../../../utils/api'; |
| 7 | + |
| 8 | +export const meta = { |
| 9 | + title: '{{titleCase component-name}} - Components', //TODO: change to titleCase ("Component Name") |
| 10 | + package: '@twilio-paste/{{kebabCase component-name}}', |
| 11 | + description: packageJson.description, |
| 12 | + slug: '/components/{{kebabCase component-name}}/api', |
| 13 | +}; |
| 14 | + |
| 15 | +export default ComponentPageLayout; |
| 16 | + |
| 17 | +export const getStaticProps = async () => { |
| 18 | + const navigationData = await getNavigationData(); |
| 19 | + const feature = await getFeature('{{titleCase component-name}}'); //TODO: change to titleCase ("Component Name") |
| 20 | + const {componentApi, componentApiTocData} = getComponentApi('@twilio-paste/{{kebabCase component-name}}'); |
| 21 | + return { |
| 22 | + props: { |
| 23 | + data: { |
| 24 | + ...packageJson, |
| 25 | + ...feature, |
| 26 | + }, |
| 27 | + componentApi, |
| 28 | + mdxHeadings: [...mdxHeadings, ...componentApiTocData], |
| 29 | + navigationData, |
| 30 | + pageHeaderData: { |
| 31 | + categoryRoute: SidebarCategoryRoutes.COMPONENTS, |
| 32 | + githubUrl: 'https://github.com/twilio-labs/paste/tree/main/packages/paste-core/components/{{kebabCase component-name}}', |
| 33 | + storybookUrl: '/?path=/story/components-{{kebabCase component-name}}', //TODO: update this to the correct storybook URL |
| 34 | + }, |
| 35 | + }, |
| 36 | + }; |
| 37 | +}; |
| 38 | + |
| 39 | +## Installation |
| 40 | + |
| 41 | +```bash |
| 42 | +yarn add @twilio-paste/{{kebabCase component-name}} - or - yarn add @twilio-paste/core |
| 43 | +``` |
| 44 | + |
| 45 | +## Usage |
| 46 | + |
| 47 | +```jsx |
| 48 | +import { {{pascalCase component-name}} } from '@twilio-paste/core/{{kebabCase component-name}}'; |
| 49 | + |
| 50 | +const {{pascalCase component-name}}Example = () => { |
| 51 | + return ( |
| 52 | + <{{pascalCase component-name}} /> |
| 53 | + ); |
| 54 | +}; |
| 55 | +``` |
| 56 | + |
| 57 | +## Props |
| 58 | + |
| 59 | +<PropsTable componentApi={props.componentApi} /> |
0 commit comments