feat(typography): text type

This commit is contained in:
07akioni 2020-02-18 13:02:32 +08:00
parent 714f7fac7b
commit 46e38547bd
2 changed files with 41 additions and 2 deletions

View File

@ -4,14 +4,35 @@ import getTheme from './getTheme'
export default {
name: 'NP',
functional: true,
props: {
primary: {
type: Boolean,
default: false
},
secondary: {
type: Boolean,
default: false
},
tertiary: {
type: Boolean,
default: false
}
},
render (h, context) {
const on = context.listeners
const theme = getTheme(context.parent)
const props = context.props
const defaultSlot = context.slots.default || (context.scopedSlots.default && context.scopedSlots.default())
const isPrimary = props.primary
const isSecondary = props.secondary
const isTertiary = props.tertiary
return h('p', {
staticClass: 'n-p',
class: {
[`n-${theme}-theme`]: theme
[`n-${theme}-theme`]: theme,
'n-p--primary': isPrimary,
'n-p--secondary': isSecondary,
'n-p--tertiary': isTertiary
},
...context.data,
on

View File

@ -32,6 +32,18 @@ export default {
underline: {
type: Boolean,
default: false
},
primary: {
type: Boolean,
default: false
},
secondary: {
type: Boolean,
default: false
},
tertiary: {
type: Boolean,
default: false
}
},
render (h, context) {
@ -43,6 +55,9 @@ export default {
const isItalic = props.italic
const isDisabled = props.disabled
const isUnderline = props.underline
const isPrimary = props.primary
const isSecondary = props.secondary
const isTertiary = props.tertiary
const on = context.listeners
const theme = getTheme(context.parent)
const defaultSlot = context.slots.default || (context.scopedSlots.default && context.scopedSlots.default())
@ -56,7 +71,10 @@ export default {
'n-text--strong': isStrong,
'n-text--italic': isItalic,
'n-text--disabled': isDisabled,
'n-text--underline': isUnderline
'n-text--underline': isUnderline,
'n-text--primary': isPrimary,
'n-text--secondary': isSecondary,
'n-text--tertiary': isTertiary
},
...context.data,
on