imporved heading component

This commit is contained in:
Grzegorz Leoniec 2018-10-26 14:22:38 +02:00
parent 6b24804eb0
commit 7cc53d7426
3 changed files with 57 additions and 3 deletions

View File

@ -4,8 +4,10 @@
class="ds-heading" class="ds-heading"
:class="[ :class="[
`ds-heading-${size || tag}`, `ds-heading-${size || tag}`,
align && `ds-heading-align-${align}`,
primary && `ds-heading-primary`, primary && `ds-heading-primary`,
soft && `ds-heading-soft` soft && `ds-heading-soft`,
noMargin && `ds-heading-no-margin`
]" ]"
> >
<slot /> <slot />
@ -59,6 +61,25 @@ export default {
soft: { soft: {
type: Boolean, type: Boolean,
default: false default: false
},
/**
* Remove Margin
* `true, false`
*/
noMargin: {
type: Boolean,
default: false
},
/**
* Text Align
* `left, center, right`
*/
align: {
type: String,
default: null,
validator: value => {
return value.match(/(left|center|right)/)
}
} }
} }
} }

View File

@ -32,3 +32,22 @@ Use primary headings for important headlines, like a page title. Use soft headin
<ds-heading primary>The quick brown fox</ds-heading> <ds-heading primary>The quick brown fox</ds-heading>
<ds-heading soft>The quick brown fox</ds-heading> <ds-heading soft>The quick brown fox</ds-heading>
``` ```
## No Margin
You can remove the margin easily
```
<ds-heading no-margin>The quick brown fox</ds-heading>
<ds-heading no-margin>The quick brown fox</ds-heading>
```
## Text Align
Align text
```
<ds-heading align="left">The quick brown fox</ds-heading>
<ds-heading align="center">The quick brown fox</ds-heading>
<ds-heading align="right">The quick brown fox</ds-heading>
```

View File

@ -41,3 +41,17 @@
.ds-heading-h6 { .ds-heading-h6 {
font-size: $font-size-small; font-size: $font-size-small;
} }
.ds-heading-no-margin {
margin: 0;
}
.ds-heading-align-left {
text-align: left
}
.ds-heading-align-center {
text-align: center
}
.ds-heading-align-right {
text-align: right
}