Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit a4ec441

Browse files
committed
feat(playground): playground ui
1 parent a230a41 commit a4ec441

File tree

16 files changed

+214
-0
lines changed

16 files changed

+214
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

playground/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
*.local

playground/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="icon" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.js"></script>
12+
</body>
13+
</html>

playground/playground.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [ ] read all `component-name.story.vue` files inside the `./packages` directory
2+
- [ ] For each Vue file found, parse the component javascript

playground/public/favicon.ico

4.19 KB
Binary file not shown.

playground/src/.generated/.gitignore

Whitespace-only changes.

playground/src/.generated/imports.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Component_1 from "../components/Home.vue";
2+
const Component_2 = () => import('@chakra-ui/c-alert/examples/base-alert.vue')
3+
const Component_3 = () => import('@chakra-ui/c-box/examples/base-box.vue')
4+
const Component_4 = () => import('@chakra-ui/c-box/examples/box-with-chakra-directive.vue')
5+
const Component_5 = () => import('@chakra-ui/c-button/examples/base-button.vue')
6+
7+
export default {
8+
"../components/Home.vue": Component_1,
9+
"@chakra-ui/c-alert/examples/base-alert.vue": Component_2,
10+
"@chakra-ui/c-box/examples/base-box.vue": Component_3,
11+
"@chakra-ui/c-box/examples/box-with-chakra-directive.vue": Component_4,
12+
"@chakra-ui/c-button/examples/base-button.vue": Component_5
13+
}

playground/src/.generated/routes.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[
2+
{
3+
"name": "Home",
4+
"path": "/",
5+
"component": "../components/Home.vue"
6+
},
7+
{
8+
"name": "Alert",
9+
"path": "/c-alert",
10+
"children": [
11+
{
12+
"name": "Base alert",
13+
"path": "/c-alert/base-alert",
14+
"component": "@chakra-ui/c-alert/examples/base-alert.vue"
15+
}
16+
]
17+
},
18+
{
19+
"name": "Box",
20+
"path": "/c-box",
21+
"children": [
22+
{
23+
"name": "Base box",
24+
"path": "/c-box/base-box",
25+
"component": "@chakra-ui/c-box/examples/base-box.vue"
26+
},
27+
{
28+
"name": "Box with chakra directive",
29+
"path": "/c-box/box-with-chakra-directive",
30+
"component": "@chakra-ui/c-box/examples/box-with-chakra-directive.vue"
31+
}
32+
]
33+
},
34+
{
35+
"name": "Button",
36+
"path": "/c-button",
37+
"children": [
38+
{
39+
"name": "Base button",
40+
"path": "/c-button/base-button",
41+
"component": "@chakra-ui/c-button/examples/base-button.vue"
42+
}
43+
]
44+
}
45+
]

playground/src/App.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
<router-view />
3+
</template>

playground/src/components/Home.vue

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<template>
2+
<Examples :examples="examples" />
3+
</template>
4+
5+
<script>
6+
import { defineComponent, h } from 'vue'
7+
import CButton from '@chakra-ui/c-button'
8+
import { RouterLink } from 'vue-router'
9+
import routes from '../.generated/routes.json'
10+
11+
const Examples = defineComponent({
12+
props: ['examples'],
13+
setup(props) {
14+
return () => {
15+
return h(
16+
'ul',
17+
props.examples.map(example =>
18+
h(
19+
'li',
20+
{ key: example.path },
21+
example.children
22+
? h('h3', example.name)
23+
: [h(RouterLink, { to: example.path }, () => example.name)],
24+
example.children && h(Examples, { examples: example.children })
25+
)
26+
)
27+
)
28+
}
29+
},
30+
})
31+
32+
export default defineComponent({
33+
components: { Examples, CButton },
34+
setup() {
35+
return {
36+
examples: routes,
37+
}
38+
},
39+
})
40+
</script>

0 commit comments

Comments
 (0)