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

Commit 7251747

Browse files
committed
feat(c-icon): create icon component
1 parent b8826a2 commit 7251747

File tree

5 files changed

+85
-0
lines changed

5 files changed

+85
-0
lines changed

packages/c-icon/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# @chakra-ui/c-icon
2+
3+
A component to display icons in the browser
4+
5+
## Installation
6+
7+
```sh
8+
yarn add @chakra-ui/c-icon
9+
# or
10+
npm i @chakra-ui/c-icon
11+
```

packages/c-icon/package.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "@chakra-ui/c-icon",
3+
"description": "Chakra UI Vue | A component to display icons in the browser 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+
"exports": {
16+
".": {
17+
"require": "./dist/cjs/index.js",
18+
"default": "./dist/esm/index.js"
19+
}
20+
},
21+
"publishConfig": {
22+
"access": "public"
23+
},
24+
"repository": {
25+
"type": "git",
26+
"url": "git+https://github.com/chakra-ui/chakra-ui-vue-next.git"
27+
},
28+
"bugs": {
29+
"url": "https://github.com/chakra-ui/chakra-ui=vue-next/issues"
30+
},
31+
"sideEffects": false,
32+
"scripts": {
33+
"build": "concurrently yarn:build:*",
34+
"build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts -d dist/esm --source-maps",
35+
"build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts -d dist/cjs --source-maps",
36+
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
37+
"watch": "concurrently yarn:watch:*",
38+
"watch:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts -d dist/esm --source-maps --watch",
39+
"watch:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts -d dist/cjs --source-maps --watch",
40+
"watch:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types --watch"
41+
},
42+
"dependencies": {
43+
"@chakra-ui/styled-system": "^1.4.1",
44+
"@chakra-ui/vue-system": "*",
45+
"@chakra-ui/vue-utils": "*"
46+
},
47+
"peerDependencies": {
48+
"vue": ">=3.0.5"
49+
}
50+
}

packages/c-icon/src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { h, defineComponent, PropType } from 'vue'
2+
3+
export const CIcon = defineComponent({
4+
props: {
5+
as: {
6+
type: Object as PropType<string>,
7+
default: 'div',
8+
},
9+
},
10+
setup(props, { slots, attrs }) {
11+
return h(props?.as, { ...attrs }, slots.default?.())
12+
},
13+
})

packages/c-icon/tests/c-icon.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { render } from '../../test-utils/src'
2+
import { CIcon } from '../src'
3+
4+
it('should render properly', () => {
5+
const { asFragment } = render(CIcon)
6+
expect(asFragment()).toMatchSnapshot()
7+
})

packages/c-icon/tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"include": ["src"]
4+
}

0 commit comments

Comments
 (0)