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

Commit fbd2bad

Browse files
committed
feat(c-badge): add component and write tests
1 parent da1c7f6 commit fbd2bad

File tree

19 files changed

+242
-28
lines changed

19 files changed

+242
-28
lines changed

_templates/generator/component/component.ts.ejs.t

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
to: packages/<%=h.changeCase.paramCase(name)%>/src/index.ts
2+
to: packages/<%=h.changeCase.paramCase(name)%>/src/<%=h.changeCase.paramCase(name)%>.ts
33
---
44

55
import { h, defineComponent, PropType } from 'vue'
66
import { chakra, DOMElements } from '@chakra-ui/vue-system'
77

8-
export const <%= h.changeCase.pascalCase(name) %> = defineComponent({
8+
const <%= h.changeCase.pascalCase(name) %> = defineComponent({
99
props: {
1010
as: {
1111
type: [Object, String] as PropType<DOMElements>,
@@ -16,3 +16,5 @@ export const <%= h.changeCase.pascalCase(name) %> = defineComponent({
1616
return () => h(chakra(props.as), { ...attrs }, slots)
1717
},
1818
})
19+
20+
export default <%= h.changeCase.pascalCase(name) %>

_templates/generator/component/examples.vue.ejs.t

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,3 @@ to: packages/<%=h.changeCase.paramCase(name)%>/examples/base-<%=h.changeCase.par
55
<template>
66
<<%=h.changeCase.paramCase(name)%>> HELLO <%=h.changeCase.pascalCase(name)%> </<%=h.changeCase.paramCase(name)%>>
77
</template>
8-
9-
<script lang="ts">
10-
import { <%=h.changeCase.pascalCase(name)%> } from '@chakra-ui/<%=h.changeCase.paramCase(name)%>/src'
11-
import { defineComponent } from 'vue'
12-
13-
export default defineComponent({
14-
name: 'Base<%= h.changeCase.pascalCase(name) %>Example',
15-
components: { <%= h.changeCase.pascalCase(name) %> },
16-
})
17-
</script>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
to: packages/<%=h.changeCase.paramCase(name)%>/src/index.ts
3+
---
4+
5+
export { default as <%= h.changeCase.pascalCase(name) %> } from '@chakra-ui/<%=h.changeCase.paramCase(name)%>'

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"c-button": "yarn workspace @chakra-ui/c-button",
3232
"c-icon": "yarn workspace @chakra-ui/c-icon",
3333
"c-reset": "yarn workspace @chakra-ui/c-reset",
34-
"c-spinner": "yarn workspace @chakra-ui/c-spinner"
34+
"c-spinner": "yarn workspace @chakra-ui/c-spinner",
35+
"c-badge": "yarn workspace @chakra-ui/c-badge"
3536
},
3637
"license": "MIT",
3738
"private": true,

packages/c-badge/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# @chakra-ui/c-badge
2+
3+
Badges are used to highlight an item s status for quick recognition
4+
5+
## Installation
6+
7+
```sh
8+
yarn add @chakra-ui/c-badge
9+
# or
10+
npm i @chakra-ui/c-badge
11+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
<c-badge> New ! </c-badge>
3+
</template>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<chakra.div>
3+
<c-badge
4+
v-for="(color, i) in colorSchemes"
5+
:key="i"
6+
:color-scheme="color"
7+
variant="outline"
8+
mr="2"
9+
>
10+
{{ color }}
11+
</c-badge>
12+
</chakra.div>
13+
</template>
14+
15+
<script setup lang="ts">
16+
import { ref } from 'vue'
17+
18+
const colorSchemes = ref(['gray', 'green', 'red', 'orange', 'purple', 'teal'])
19+
</script>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<chakra class="div">
3+
<c-badge
4+
v-for="(color, i) in colorSchemes"
5+
:key="i"
6+
:color-scheme="color"
7+
variant="solid"
8+
mr="2"
9+
>
10+
{{ color }}
11+
</c-badge>
12+
</chakra>
13+
</template>
14+
15+
<script setup lang="ts">
16+
import { ref } from 'vue'
17+
18+
const colorSchemes = ref(['gray', 'green', 'red', 'orange', 'purple', 'teal'])
19+
</script>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<chakra.div>
3+
<c-badge
4+
v-for="(color, i) in colorSchemes"
5+
:key="i"
6+
:color-scheme="color"
7+
variant="subtle"
8+
mr="2"
9+
>
10+
{{ color }}
11+
</c-badge>
12+
</chakra.div>
13+
</template>
14+
15+
<script setup lang="ts">
16+
import { ref } from 'vue'
17+
18+
const colorSchemes = ref(['gray', 'green', 'red', 'orange', 'purple', 'teal'])
19+
</script>

packages/c-badge/package.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "@chakra-ui/c-badge",
3+
"description": "Chakra UI Vue | Badges are used to highlight an item s status for quick recognition component",
4+
"version": "1.0.0",
5+
"main": "dist/cjs/index.js",
6+
"module": "dist/esm/index.js",
7+
"types": "dist/types/index.d.ts",
8+
"typings": "dist/types/index.d.ts",
9+
"author": "Jonathan Bakebwa <[email protected]>",
10+
"homepage": "https://github.com/chakra-ui/chakra-ui-vue-next#readme",
11+
"license": "MIT",
12+
"files": [
13+
"dist"
14+
],
15+
16+
"publishConfig": {
17+
"access": "public"
18+
},
19+
"repository": {
20+
"type": "git",
21+
"url": "git+https://github.com/chakra-ui/chakra-ui-vue-next.git"
22+
},
23+
"bugs": {
24+
"url": "https://github.com/chakra-ui/chakra-ui=vue-next/issues"
25+
},
26+
"sideEffects": false,
27+
"scripts": {
28+
"build": "concurrently yarn:build:*",
29+
"build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps",
30+
"build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps",
31+
"build:types": "cross-env tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
32+
"watch": "concurrently yarn:watch:*",
33+
"watch:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps --watch",
34+
"watch:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps --watch",
35+
"watch:types": "cross-env tsc --emitDeclarationOnly --declaration --declarationDir dist/types --watch"
36+
},
37+
"dependencies": {
38+
"@chakra-ui/styled-system": "^1.4.1",
39+
"@chakra-ui/vue-system": "*",
40+
"@chakra-ui/vue-utils": "*"
41+
},
42+
"peerDependencies": {
43+
"vue": ">=3.0.5"
44+
}
45+
}

0 commit comments

Comments
 (0)