added missing component

This commit is contained in:
Grzegorz Leoniec 2018-10-10 14:44:04 +02:00
parent 4f784a7628
commit 43fbb5bc96
3 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,56 @@
<template>
<component
:is="tag"
:aria-label="ariaLabel"
class="ds-icon"
>
<component
v-if="svgComponent"
:is="svgComponent"
class="ds-icon-svg"/>
</component>
</template>
<script>
import icons from '@@/icons'
/**
* Icons are used to add meaning and improve accessibility.
* @version 1.0.0
*/
export default {
name: 'DsIcon',
props: {
/**
* The name of the icon.
*/
name: {
type: String,
required: true
},
/**
* Descriptive text to be read to screenreaders.
*/
ariaLabel: {
type: String,
default: 'icon'
},
/**
* The html element name used for the icon.
*/
tag: {
type: String,
default: 'span'
}
},
computed: {
svgComponent() {
return icons[this.name]
}
}
}
</script>
<style lang="scss" src="./style.scss">
</style>
<docs src="./demo.md"></docs>

View File

@ -0,0 +1,16 @@
## Basic usage
Simply provide the name for the icon.
```
<ds-icon name="plus"></ds-icon>
<ds-icon name="user"></ds-icon>
<ds-icon name="comments"></ds-icon>
<ds-icon name="ban"></ds-icon>
```
## Icon list
Below is a list of all available icons. If you want to change these icons or want to add new ones, put them in `system/icons/svg`.
<icon-list></icon-list>

View File

@ -0,0 +1,20 @@
.ds-icon {
@include reset;
display: inline-flex;
align-items: center;
vertical-align: middle;
height: 1em;
}
.ds-icon-svg {
line-height: 1;
height: 1.2em;
// Use this if the icons are build with strokes
// stroke: currentColor;
// stroke-width: 2.5px;
// stroke-linejoin: miter;
// stroke-linecap: miter;
// overflow: visible;
// Use this if the icons are build with solids
fill: currentColor
}