implement underline text as error (#1015)

main
Michael Fix 5 years ago committed by GitHub
parent fcd5cee30b
commit b4db340511
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -34,6 +34,15 @@ function searchLanguage(l) {
} }
function noop() {} function noop() {}
function getUnderline(underline) {
switch (underline) {
case 1:
return 'underline'
case 2:
return `${COLORS.RED} wavy underline; text-decoration-skip-ink: none`
}
return 'initial'
}
class Carbon extends React.PureComponent { class Carbon extends React.PureComponent {
static defaultProps = { static defaultProps = {
@ -115,8 +124,7 @@ class Carbon extends React.PureComponent {
const css = [ const css = [
changes.bold != null && `font-weight: ${changes.bold ? 'bold' : 'initial'}`, changes.bold != null && `font-weight: ${changes.bold ? 'bold' : 'initial'}`,
changes.italics != null && `font-style: ${changes.italics ? 'italic' : 'initial'}`, changes.italics != null && `font-style: ${changes.italics ? 'italic' : 'initial'}`,
changes.underline != null && changes.underline != null && `text-decoration: ${getUnderline(changes.underline)}`,
`text-decoration: ${changes.underline ? 'underline' : 'initial'}`,
changes.color != null && `color: ${changes.color} !important`, changes.color != null && `color: ${changes.color} !important`,
] ]
.filter(Boolean) .filter(Boolean)

@ -37,7 +37,7 @@ function reducer(state, action) {
case 'UNDERLINE': { case 'UNDERLINE': {
return { return {
...state, ...state,
underline: !state.underline, underline: Number(state.underline + 1) % 3,
} }
} }
case 'COLOR': { case 'COLOR': {

Loading…
Cancel
Save