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

Commit af71d01

Browse files
committed
feat: resolve playground components
1 parent 73b807f commit af71d01

File tree

17 files changed

+87
-81
lines changed

17 files changed

+87
-81
lines changed

.eslintrc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ extends:
77
- plugin:prettier/recommended
88
- plugin:vue/essential
99
- '@vue/typescript'
10-
parser: '@typescript-eslint/parser'
10+
parser: vue-eslint-parser
1111
parserOptions:
12+
parser: '@typescript-eslint/parser'
1213
ecmaVersion: 12
1314
sourceType: module
1415
plugins:
@@ -22,3 +23,4 @@ rules:
2223
singleline:
2324
delimiter: comma
2425
requireLast: false
26+
vue/no-multiple-template-root: 'off'

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
"scripts": {
1212
"build": "lerna run build",
1313
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
14-
1514
"scaffold": "hygen",
1615
"playground:routes": "ts-node ./scripts/parse-routes.ts",
1716
"playground": "yarn playground:routes && NODE_ENV=development vite serve playground",
18-
"playground:build": "yarn build && yarn playground:routes && NODE_ENV=production vite build playground",
19-
17+
"playground:build": "yarn playground:routes && NODE_ENV=production vite build playground",
2018
"c-alert": "yarn workspace @chakra-ui/c-alert",
2119
"c-box": "yarn workspace @chakra-ui/c-box",
2220
"c-button": "yarn workspace @chakra-ui/c-button",
@@ -32,6 +30,7 @@
3230
"@typescript-eslint/parser": "^2.34.0",
3331
"@vue/eslint-config-typescript": "^5.1.0",
3432
"concurrently": "^5.3.0",
33+
"consola": "^2.15.0",
3534
"cross-env": "^7.0.2",
3635
"eslint": "^7.0.0",
3736
"eslint-config-prettier": "^6.12.0",
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
<template>
2-
<div>
3-
HELLO ALERT
4-
</div>
2+
<c-alert class="chakra-alert"> HELLO ALERT </c-alert>
3+
<p>Alert paragraph</p>
54
</template>
65

76
<script lang="ts">
8-
import CAlert from '@chakra-ui/c-alert'
7+
import CAlert from '@chakra-ui/c-alert/src'
98
import { defineComponent } from 'vue'
109
1110
export default defineComponent({
12-
setup () {
13-
return {}
14-
}
11+
components: { CAlert },
1512
})
16-
</script>
13+
</script>

packages/c-alert/src/index.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
import { h, defineComponent, PropType } from 'vue'
1+
import { h, defineComponent, Component } from 'vue'
22

33
const CAlert = defineComponent({
44
props: {
55
as: {
6-
type: String as PropType<string>,
6+
type: [String, Object],
77
default: 'div',
88
},
99
},
1010
render() {
11-
return h(this?.as, { ...this.$props, ...this.$attrs }, this.$slots.default)
11+
return h(
12+
this.as,
13+
{
14+
...this.$attrs,
15+
role: 'alert',
16+
},
17+
this.$slots.default && this.$slots.default()
18+
)
1219
},
1320
})
1421

packages/c-box/examples/base-box.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
</template>
77

88
<script lang="ts">
9-
import CBox from '@chakra-ui/c-box'
109
import { defineComponent, ref } from 'vue'
10+
import CBox from '@chakra-ui/c-box/src'
1111
1212
export default defineComponent({
1313
setup() {
1414
const val = ref('Hello box')
1515
console.log('Base box setup ')
1616
return {
17-
val
17+
val,
1818
}
19-
}
19+
},
2020
})
21-
</script>
21+
</script>

packages/c-box/examples/box-with-chakra-directive.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<template>
2-
<c-box>
3-
Boxy box
4-
</c-box>
2+
<c-box> Boxy box </c-box>
53
</template>
64

75
<script lang="ts">
8-
import CBox from '@chakra-ui/c-box'
6+
import CBox from '@chakra-ui/c-box/src'
97
import { defineComponent } from 'vue'
108
119
export default defineComponent({
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
<template>
22
<div>
3-
Base button ◻️
3+
<c-button> Base button ◻️ </c-button>
44
</div>
55
</template>
66

77
<script lang="ts">
8-
import CButton from '@chakra-ui/c-button'
8+
import CButton from '@chakra-ui/c-button/src'
99
import { defineComponent } from 'vue'
1010
1111
export default defineComponent({
12-
setup () {
13-
14-
return {}
15-
}
12+
components: { CButton },
1613
})
17-
</script>
14+
</script>

packages/c-button/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import { h, defineComponent, PropType } from 'vue'
22

33
const CButton = defineComponent({
4+
name: 'CButton',
45
props: {
56
as: {
67
type: String as PropType<string>,
7-
default: 'div',
8+
default: 'button',
89
},
910
},
1011
render() {
11-
return h(this?.as, { ...this.$props, ...this.$attrs }, this.$slots.default)
12+
return h(
13+
this?.as,
14+
{ ...this.$props, ...this.$attrs },
15+
this.$slots.default && this.$slots.default()
16+
)
1217
},
1318
})
1419

playground/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<meta charset="UTF-8">
55
<link rel="icon" href="/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>Vite App</title>
7+
<title>Chakra UI Vue Next - Components playground</title>
88
</head>
99
<body>
1010
<div id="app"></div>
11-
<script type="module" src="/src/main.js"></script>
11+
<script type="module" src="/src/main.ts"></script>
1212
</body>
1313
</html>

playground/src/App.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<template>
22
<section class="root">
33
<sidebar class="sidebar" :stories="stories" />
4-
<router-view class="main" />
4+
<main class="main">
5+
<router-view />
6+
</main>
57
</section>
68
</template>
79

0 commit comments

Comments
 (0)