add github icon
This commit is contained in:
38
docs/src/components/Icon/index.vue
Normal file
38
docs/src/components/Icon/index.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<script>
|
||||
export default {
|
||||
name: 'Icon',
|
||||
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
size: {
|
||||
type: String,
|
||||
default: 'normal',
|
||||
},
|
||||
},
|
||||
|
||||
render(createElement) {
|
||||
let svgHTML = ''
|
||||
try {
|
||||
svgHTML = require(`!html-loader!@/assets/icons/${this.name}.svg`)
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line
|
||||
console.warn(`Unable to load "${this.name}.svg" icon. Verify it exists in the icons directory.`, e)
|
||||
}
|
||||
return createElement(
|
||||
'div',
|
||||
{
|
||||
class: `icon icon--${this.size}`,
|
||||
domProps: {
|
||||
innerHTML: svgHTML,
|
||||
},
|
||||
},
|
||||
)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="./style.scss" scoped></style>
|
||||
15
docs/src/components/Icon/style.scss
Normal file
15
docs/src/components/Icon/style.scss
Normal file
@@ -0,0 +1,15 @@
|
||||
.icon {
|
||||
display: inline-flex;
|
||||
width: 1.3rem;
|
||||
height: 1.3rem;
|
||||
|
||||
&::v-deep > svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
fill: currentColor;
|
||||
|
||||
* {
|
||||
fill: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user