Skip to content

Commit

Permalink
implement underline text as error (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix22 authored May 20, 2020
1 parent fcd5cee commit b4db340
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions components/Carbon.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ function searchLanguage(l) {
}

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 {
static defaultProps = {
Expand Down Expand Up @@ -115,8 +124,7 @@ class Carbon extends React.PureComponent {
const css = [
changes.bold != null && `font-weight: ${changes.bold ? 'bold' : 'initial'}`,
changes.italics != null && `font-style: ${changes.italics ? 'italic' : 'initial'}`,
changes.underline != null &&
`text-decoration: ${changes.underline ? 'underline' : 'initial'}`,
changes.underline != null && `text-decoration: ${getUnderline(changes.underline)}`,
changes.color != null && `color: ${changes.color} !important`,
]
.filter(Boolean)
Expand Down
2 changes: 1 addition & 1 deletion components/SelectionEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function reducer(state, action) {
case 'UNDERLINE': {
return {
...state,
underline: !state.underline,
underline: Number(state.underline + 1) % 3,
}
}
case 'COLOR': {
Expand Down

0 comments on commit b4db340

Please sign in to comment.