refactor(typography): use global line-height

This commit is contained in:
07akioni 2020-12-15 17:15:13 +08:00
parent 3cdb84979c
commit ea367204dc
10 changed files with 88 additions and 68 deletions

View File

@ -3,11 +3,13 @@ import { c, cTB } from '../../../_utils/cssr'
export default c([ export default c([
({ props }) => { ({ props }) => {
const { const {
cubicBezierEaseInOut $global: {
} = props.$global cubicBezierEaseInOut
const { },
aTextColor $local: {
} = props.$local aTextColor
}
} = props
return cTB('a', { return cTB('a', {
cursor: 'pointer', cursor: 'pointer',
transition: ` transition: `

View File

@ -2,14 +2,17 @@ import { c, cTB, cM } from '../../../_utils/cssr'
export default c([ export default c([
({ props }) => { ({ props }) => {
const { cubicBezierEaseInOut } = props.$global
const { const {
blockquotePrefixColor, $global: { cubicBezierEaseInOut },
blockquoteTextColor $local: {
} = props.$local blockquotePrefixColor,
blockquoteTextColor,
blockquoteLineHeight
}
} = props
return cTB('blockquote', { return cTB('blockquote', {
raw: ` raw: `
line-height: 1.75; line-height: ${blockquoteLineHeight};
margin: 0; margin: 0;
margin-top: 12px; margin-top: 12px;
margin-bottom: 12px; margin-bottom: 12px;

View File

@ -11,21 +11,24 @@ export default c([
function headerStyle (level, props) { function headerStyle (level, props) {
const { const {
$local $local,
$global: {
cubicBezierEaseInOut
}
} = props } = props
const {
cubicBezierEaseInOut
} = props.$global
const { const {
headerTextColor, headerTextColor,
headerFontWeight headerFontWeight,
[createKey('headerBarWidth', level)]: barWidth,
[createKey('headerFontSize', level)]: fontSize,
[createKey('headerMargin', level)]: margin,
[createKey('headerPrefixWidth', level)]: prefixWidth
} = $local } = $local
const barWidth = $local[createKey('headerBarWidth', level)]
const barRadius = pxfy(depx(barWidth) / 2) const barRadius = pxfy(depx(barWidth) / 2)
return cTB('h' + level, { return cTB('h' + level, {
fontSize: $local[createKey('headerFontSize', level)], fontSize,
fontWeight: headerFontWeight, fontWeight: headerFontWeight,
margin: $local[createKey('headerMargin', level)], margin,
transition: `color .3s ${cubicBezierEaseInOut}`, transition: `color .3s ${cubicBezierEaseInOut}`,
color: headerTextColor color: headerTextColor
}, [ }, [
@ -34,13 +37,13 @@ function headerStyle (level, props) {
}), }),
cM('prefix-bar', { cM('prefix-bar', {
position: 'relative', position: 'relative',
paddingLeft: $local[createKey('headerPrefixWidth', level)] paddingLeft: prefixWidth
}, [ }, [
cM('align-text', { cM('align-text', {
paddingLeft: 0 paddingLeft: 0
}, [ }, [
c('&::before', { c('&::before', {
left: '-' + $local[createKey('headerPrefixWidth', level)] left: '-' + prefixWidth
}) })
]), ]),
c('&::before', { c('&::before', {

View File

@ -3,11 +3,13 @@ import { c, cTB } from '../../../_utils/cssr'
export default c([ export default c([
({ props }) => { ({ props }) => {
const { const {
cubicBezierEaseInOut $global: {
} = props.$global cubicBezierEaseInOut
const { },
hrColor $local: {
} = props.$local hrColor
}
} = props
return cTB('hr', { return cTB('hr', {
margin: '12px 0', margin: '12px 0',
transition: `border-color .3s ${cubicBezierEaseInOut}`, transition: `border-color .3s ${cubicBezierEaseInOut}`,

View File

@ -3,16 +3,18 @@ import { c, cTB, cB, cM } from '../../../_utils/cssr'
export default c([ export default c([
({ props }) => { ({ props }) => {
const { const {
cubicBezierEaseInOut $local: {
} = props.$global olPadding,
const { ulPadding,
olPadding, liFontSize,
ulPadding, liMargin,
liFontSize, liLineHeight,
liMargin, liTextColor
liLineHeight, },
liTextColor $global: {
} = props.$local cubicBezierEaseInOut
}
} = props
return [ return [
cTB('ol', { cTB('ol', {
fontSize: liFontSize, fontSize: liFontSize,

View File

@ -3,17 +3,19 @@ import { c, cTB, cM } from '../../../_utils/cssr'
export default c([ export default c([
({ props }) => { ({ props }) => {
const { const {
cubicBezierEaseInOut $local: {
} = props.$global pFontSize,
const { pLineHeight,
pFontSize, pMargin,
pLineHeight, pTextColor,
pMargin, pTextColor1Depth,
pTextColor, pTextColor2Depth,
pTextColor1Depth, pTextColor3Depth
pTextColor2Depth, },
pTextColor3Depth $global: {
} = props.$local cubicBezierEaseInOut
}
} = props
return cTB('p', { return cTB('p', {
raw: ` raw: `
box-sizing: border-box; box-sizing: border-box;

View File

@ -3,26 +3,28 @@ import { c, cTB, cM } from '../../../_utils/cssr'
export default c([ export default c([
({ props }) => { ({ props }) => {
const { const {
cubicBezierEaseInOut, $global: {
fontWeightStrong, cubicBezierEaseInOut,
fontFamilyMono fontWeightStrong,
} = props.$global fontFamilyMono
const { },
textColor, $local: {
textColorStrong, textColor,
textColor1Depth, textColorStrong,
textColor2Depth, textColor1Depth,
textColor3Depth, textColor2Depth,
textColor1, textColor3Depth,
textColorInfo, textColor1,
textColorSuccess, textColorInfo,
textColorWarning, textColorSuccess,
textColorError, textColorWarning,
codeBorderRadius, textColorError,
codeTextColor, codeBorderRadius,
codeColor, codeTextColor,
codeBorderColor codeColor,
} = props.$local codeBorderColor
}
} = props
return cTB('text', { return cTB('text', {
transition: `color .3s ${cubicBezierEaseInOut}`, transition: `color .3s ${cubicBezierEaseInOut}`,
color: textColor color: textColor

View File

@ -24,10 +24,8 @@ export default {
headerBarWidth5: '3px', headerBarWidth5: '3px',
headerBarWidth6: '3px', headerBarWidth6: '3px',
pFontSize: '14px', pFontSize: '14px',
pLineHeight: '1.6',
pMargin: '0 0 16px 0', pMargin: '0 0 16px 0',
liMargin: '.25em 0 0 0', liMargin: '.25em 0 0 0',
liLineHeight: '1.6',
liFontSize: '14px', liFontSize: '14px',
olPadding: '0 0 0 2em', olPadding: '0 0 0 2em',
ulPadding: '0 0 0 2em' ulPadding: '0 0 0 2em'

View File

@ -12,8 +12,10 @@ export default create({
aTextColor: vars.primaryColor, aTextColor: vars.primaryColor,
blockquoteTextColor: vars.textColor2Overlay, blockquoteTextColor: vars.textColor2Overlay,
blockquotePrefixColor: vars.borderColorOverlay, blockquotePrefixColor: vars.borderColorOverlay,
blockquoteLineHeight: vars.lineHeight,
codeBorderRadius: vars.borderRadiusSmall, codeBorderRadius: vars.borderRadiusSmall,
liTextColor: vars.textColor2Overlay, liTextColor: vars.textColor2Overlay,
liLineHeight: vars.lineHeight,
hrColor: vars.dividerColorOverlay, hrColor: vars.dividerColorOverlay,
headerFontWeight: vars.fontWeightStrong, headerFontWeight: vars.fontWeightStrong,
headerTextColor: vars.textColor1Overlay, headerTextColor: vars.textColor1Overlay,
@ -21,6 +23,7 @@ export default create({
pTextColor1Depth: vars.textColor1Overlay, pTextColor1Depth: vars.textColor1Overlay,
pTextColor2Depth: vars.textColor2Overlay, pTextColor2Depth: vars.textColor2Overlay,
pTextColor3Depth: vars.textColor3Overlay, pTextColor3Depth: vars.textColor3Overlay,
pLineHeight: vars.lineHeight,
headerBarColor: vars.primaryColor, headerBarColor: vars.primaryColor,
headerBarColorPrimary: vars.primaryColor, headerBarColorPrimary: vars.primaryColor,
headerBarColorInfo: vars.infoColor, headerBarColorInfo: vars.infoColor,

View File

@ -12,8 +12,10 @@ export default create({
aTextColor: vars.primaryColor, aTextColor: vars.primaryColor,
blockquoteTextColor: vars.textColor2, blockquoteTextColor: vars.textColor2,
blockquotePrefixColor: vars.borderColor, blockquotePrefixColor: vars.borderColor,
blockquoteLineHeight: vars.lineHeight,
codeBorderRadius: vars.borderRadiusSmall, codeBorderRadius: vars.borderRadiusSmall,
liTextColor: vars.textColor2, liTextColor: vars.textColor2,
liLineHeight: vars.lineHeight,
hrColor: vars.dividerColor, hrColor: vars.dividerColor,
headerFontWeight: vars.fontWeightStrong, headerFontWeight: vars.fontWeightStrong,
headerTextColor: vars.textColor1, headerTextColor: vars.textColor1,
@ -21,6 +23,7 @@ export default create({
pTextColor1Depth: vars.textColor1, pTextColor1Depth: vars.textColor1,
pTextColor2Depth: vars.textColor2, pTextColor2Depth: vars.textColor2,
pTextColor3Depth: vars.textColor3, pTextColor3Depth: vars.textColor3,
pLineHeight: vars.lineHeight,
headerBarColor: vars.primaryColor, headerBarColor: vars.primaryColor,
headerBarColorPrimary: vars.primaryColor, headerBarColorPrimary: vars.primaryColor,
headerBarColorInfo: vars.infoColor, headerBarColorInfo: vars.infoColor,