This repository was archived by the owner on Jan 23, 2024. It is now read-only.
File tree 7 files changed +2998
-2324
lines changed
7 files changed +2998
-2324
lines changed Original file line number Diff line number Diff line change 1
1
dist
2
2
node_modules
3
3
.next
4
- build
4
+ build
5
+ * .hbs
Original file line number Diff line number Diff line change 6
6
"build" : " next build" ,
7
7
"lint" : " next lint" ,
8
8
"prepare" : " husky install" ,
9
- "postinstall" : " pnpm-deduplicate" ,
10
9
"gen:theme-typings" : " chakra-cli tokens theme.ts" ,
11
10
"avatars:gen" : " tsx scripts/avatars.ts" ,
12
11
"members:gen" : " tsx scripts/all-members.ts" ,
18
17
"clean" : " rm -rf pnpm-lock.yaml node_modules" ,
19
18
"reinstall" : " pnpm clean && pnpm i" ,
20
19
"deps" : " pnpm up '@chakra-ui/*' --latest" ,
20
+ "create:docs" : " plop component" ,
21
21
"content" : " contentlayer build --clearCache"
22
22
},
23
23
"dependencies" : {
54
54
"next-contentlayer" : " 0.3.0" ,
55
55
"next-seo" : " ^5.4.0" ,
56
56
"octokit" : " ^2.0.4" ,
57
+ "plop" : " ^3.1.2" ,
57
58
"prism-react-renderer" : " ^1.3.5" ,
58
59
"react" : " ^18.1.0" ,
59
60
"react-dom" : " ^18.1.0" ,
Original file line number Diff line number Diff line change
1
+ ---
2
+ id : {{componentName}}
3
+ scope : props
4
+ ---
5
+
6
+ ## Props
7
+
8
+ ### {{ component }} Props
9
+
10
+ <PropsTable of =' {{ component }} ' />
Original file line number Diff line number Diff line change
1
+ ---
2
+ id : accordion
3
+ scope : theming
4
+ ---
5
+
6
+ ## Theming
7
+
8
+ The `${{ component }} ` component is a multipart component. The styling needs to be
9
+ applied to each part specifically.
10
+
11
+ > To learn more about styling multipart components, visit the
12
+ > [Component Style](/docs/styled-system/component-style#styling-multipart-components)
13
+ > page.
14
+
15
+ ### Anatomy
16
+
Original file line number Diff line number Diff line change
1
+ ---
2
+ id : accordion
3
+ title : {{component}}
4
+ category : ' disclosure'
5
+ package : ' @chakra-ui/{{componentName}}'
6
+ description : TODO
7
+ ---
8
+
9
+ ## Import
10
+
11
+ Chakra UI exports the followings components:
12
+
13
+ - `{{ component }} `: Add description
14
+
15
+ ```js
16
+ import { {{ component }} } from '@chakra-ui/react'
17
+ ```
18
+
19
+ ## Usage
Original file line number Diff line number Diff line change
1
+ const dashCase = ( str ) => {
2
+ return str . replace ( / ( [ a - z ] ) ( [ A - Z ] ) / g, '$1-$2' ) . toLowerCase ( )
3
+ }
4
+
5
+ /**
6
+ * @param {import("plop").NodePlopAPI } plop
7
+ */
8
+ module . exports = function main ( plop ) {
9
+ plop . setGenerator ( 'component' , {
10
+ description : 'Document a component' ,
11
+ prompts : [
12
+ {
13
+ type : 'input' ,
14
+ name : 'component' ,
15
+ message : 'Enter component name:' ,
16
+ } ,
17
+ ] ,
18
+ actions ( answers ) {
19
+ const actions = [ ]
20
+ if ( ! answers ) return actions
21
+
22
+ const { component } = answers
23
+
24
+ actions . push ( {
25
+ type : 'addMany' ,
26
+ templateFiles : 'plop/component/**' ,
27
+ destination : `./content/docs/components/{{dashCase component}}` ,
28
+ base : 'plop/component' ,
29
+ data : { component, componentName : dashCase ( component ) } ,
30
+ abortOnFail : true ,
31
+ } )
32
+
33
+ return actions
34
+ } ,
35
+ } )
36
+ }
You can’t perform that action at this time.
0 commit comments