-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add create-docs script and templates (#4105)
- Loading branch information
Showing
6 changed files
with
191 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
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 | ||
import packageJson from '@twilio-paste/{{kebabCase component-name}}/package.json'; | ||
|
||
import {SidebarCategoryRoutes} from '../../../constants'; | ||
import ComponentPageLayout from '../../../layouts/ComponentPageLayout'; | ||
import {getFeature, getNavigationData, getComponentApi} from '../../../utils/api'; | ||
|
||
export const meta = { | ||
title: '{{titleCase component-name}} - Components', //TODO: change to titleCase ("Component Name") | ||
package: '@twilio-paste/{{kebabCase component-name}}', | ||
description: packageJson.description, | ||
slug: '/components/{{kebabCase component-name}}/api', | ||
}; | ||
|
||
export default ComponentPageLayout; | ||
|
||
export const getStaticProps = async () => { | ||
const navigationData = await getNavigationData(); | ||
const feature = await getFeature('{{titleCase component-name}}'); //TODO: change to titleCase ("Component Name") | ||
const {componentApi, componentApiTocData} = getComponentApi('@twilio-paste/{{kebabCase component-name}}'); | ||
return { | ||
props: { | ||
data: { | ||
...packageJson, | ||
...feature, | ||
}, | ||
componentApi, | ||
mdxHeadings: [...mdxHeadings, ...componentApiTocData], | ||
navigationData, | ||
pageHeaderData: { | ||
categoryRoute: SidebarCategoryRoutes.COMPONENTS, | ||
githubUrl: 'https://github.com/twilio-labs/paste/tree/main/packages/paste-core/components/{{kebabCase component-name}}', | ||
storybookUrl: '/?path=/story/components-{{kebabCase component-name}}', //TODO: update this to the correct storybook URL | ||
}, | ||
}, | ||
}; | ||
}; | ||
|
||
## Installation | ||
|
||
```bash | ||
yarn add @twilio-paste/{{kebabCase component-name}} - or - yarn add @twilio-paste/core | ||
``` | ||
|
||
## Usage | ||
|
||
```jsx | ||
import { {{pascalCase component-name}} } from '@twilio-paste/core/{{kebabCase component-name}}'; | ||
|
||
const {{pascalCase component-name}}Example = () => { | ||
return ( | ||
<{{pascalCase component-name}} /> | ||
); | ||
}; | ||
``` | ||
|
||
## Props | ||
|
||
<PropsTable componentApi={props.componentApi} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import {SidebarCategoryRoutes} from '../../../constants'; | ||
import Changelog from '@twilio-paste/{{kebabCase component-name}}/CHANGELOG.md'; | ||
import packageJson from '@twilio-paste/{{kebabCase component-name}}/package.json'; | ||
import ComponentPageLayout from '../../../layouts/ComponentPageLayout'; | ||
import {getFeature, getNavigationData} from '../../../utils/api'; | ||
|
||
export const meta = { | ||
title: '{{titleCase component-name}} - Components', //TODO: change to titleCase ("Component Name") | ||
package: '@twilio-paste/{{kebabCase component-name}}', | ||
description: packageJson.description, | ||
slug: '/components/{{kebabCase component-name}}/changelog', | ||
}; | ||
|
||
export default ComponentPageLayout; | ||
|
||
export const getStaticProps = async () => { | ||
const navigationData = await getNavigationData(); | ||
const feature = await getFeature('{{titleCase component-name}}'); //TODO: change to titleCase ("Component Name") | ||
return { | ||
props: { | ||
data: { | ||
...packageJson, | ||
...feature, | ||
}, | ||
navigationData, | ||
mdxHeadings, | ||
pageHeaderData: { | ||
categoryRoute: SidebarCategoryRoutes.COMPONENTS, | ||
githubUrl: 'https://github.com/twilio-labs/paste/tree/main/packages/paste-core/components/{{kebabCase component-name}}', | ||
storybookUrl: '/?path=/story/components-{{kebabCase component-name}}', //TODO: Update this to the correct storybook URL | ||
}, | ||
}, | ||
}; | ||
}; | ||
|
||
<Changelog /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { {{pascalCase component-name}} } from '@twilio-paste/{{kebabCase component-name}}'; | ||
import packageJson from '@twilio-paste/{{kebabCase component-name}}/package.json'; | ||
|
||
import {SidebarCategoryRoutes} from '../../../constants'; | ||
import ComponentPageLayout from '../../../layouts/ComponentPageLayout'; | ||
import {getFeature, getNavigationData} from '../../../utils/api'; | ||
|
||
export const meta = { | ||
title: '{{titleCase component-name}} - Components', //TODO: change to titleCase ("Component Name") | ||
package: '@twilio-paste/{{kebabCase component-name}}', | ||
description: packageJson.description, | ||
slug: '/components/{{kebabCase component-name}}/', | ||
}; | ||
|
||
export default ComponentPageLayout; | ||
|
||
export const getStaticProps = async () => { | ||
const navigationData = await getNavigationData(); | ||
const feature = await getFeature('{{titleCase component-name}}'); //TODO: change to titleCase ("Component Name") | ||
return { | ||
props: { | ||
data: { | ||
...packageJson, | ||
...feature, | ||
}, | ||
navigationData, | ||
mdxHeadings, | ||
pageHeaderData: { | ||
categoryRoute: SidebarCategoryRoutes.COMPONENTS, | ||
githubUrl: 'https://github.com/twilio-labs/paste/tree/main/packages/paste-core/components/{{kebabCase component-name}}', | ||
storybookUrl: '/?path=/story/components-{{kebabCase component-name}}', //TODO: Update this to the correct storybook URL | ||
}, | ||
}, | ||
}; | ||
}; | ||
|
||
<LivePreview | ||
scope={{ pascalCase component-name }} // TODO: add double curly brackets to scope value (`scope=\{{ ... }}`) | ||
language="jsx" | ||
> | ||
{`<{{pascalCase component-name}}/>`} | ||
</LivePreview> | ||
|
||
## Guidelines | ||
|
||
## About {{titleCase component-name}} //TODO: change to titleCase ("Component Name") | ||
|
||
### Accessibility | ||
|
||
## Examples | ||
|
||
<LivePreview | ||
scope={{ pascalCase component-name }} // TODO: add double curly brackets to scope value (`scope=\{{ ... }}`) | ||
language="jsx" | ||
> | ||
{`<{{pascalCase component-name}}/>`} | ||
</LivePreview> | ||
|
||
## Composition Notes | ||
|