Skip to content

Commit

Permalink
release: v2.0.0-alpha.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mrholek committed Aug 4, 2021
1 parent 143821c commit 8b2e522
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "@coreui/icons-vue",
"version": "2.0.0-alpha.0",
"version": "2.0.0-alpha.1",
"license": "MIT",
"sideEffects": "src/CIcon.vue",
"main": "dist/index.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
Expand Down Expand Up @@ -45,6 +44,9 @@
"build": "rollup -c",
"lint": "eslint 'src/**/*.{js,ts,tsx}'"
},
"dependencies": {
"vue": "^3.0.10"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.28.5",
Expand Down
19 changes: 12 additions & 7 deletions src/CIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const CIcon = defineComponent({
},
},
setup(props, { attrs }) {

const icons: any = inject('icons')
console.log(icons)

Expand Down Expand Up @@ -98,25 +97,30 @@ const CIcon = defineComponent({

const viewBox = attrs.viewBox || `0 0 ${scale}`

// const size = () => {
// const addCustom = !props.size && (attrs.width || attrs.height)
// return props.size === 'custom' || addCustom ? 'custom-size' : props.size
// }
const classNames = props.customClasses || ['icon', { [`icon-${props.size}`]: props.size }]
const size = () => {
const addCustom = !props.size && (attrs.width || attrs.height)
return props.size === 'custom' || addCustom ? 'custom-size' : props.size
}

const classNames = (() => {
return props.customClasses || ['icon', { [`icon-${size()}`]: size() }]
})()

return () => [
!props.src &&
!props.use &&
h('svg', {
...attrs,
xmlns: 'http://www.w3.org/2000/svg',
class: classNames,
viewBox: viewBox,
innerHTML: `${titleCode} + ${iconCode}`,
innerHTML: `${titleCode}${iconCode}`,
role: 'img',
}),
props.src &&
!props.use &&
h('img', {
...attrs,
class: classNames,
src: props.src,
role: 'img',
Expand All @@ -126,6 +130,7 @@ const CIcon = defineComponent({
h(
'svg',
{
...attrs,
xmlns: 'http://www.w3.org/2000/svg',
class: classNames,
role: 'img',
Expand Down

0 comments on commit 8b2e522

Please sign in to comment.