From e885db5eff51004d5824d9923e8e11c65bba5dd8 Mon Sep 17 00:00:00 2001 From: azu Date: Sun, 2 Aug 2020 15:03:53 +0900 Subject: [PATCH] fix(textchecker-element): add style to rule name --- .../src/text-checker-popup-element.ts | 84 +++++++++---------- 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/packages/textchecker-element/src/text-checker-popup-element.ts b/packages/textchecker-element/src/text-checker-popup-element.ts index 3cb5908..2048525 100644 --- a/packages/textchecker-element/src/text-checker-popup-element.ts +++ b/packages/textchecker-element/src/text-checker-popup-element.ts @@ -98,19 +98,31 @@ export class TextCheckerPopupElement extends HTMLElement { padding: var(--padding); } -.popup-listItem--icon { +.popup-listItem--icon, .popup-listItem--iconImage { padding-right: 12px; - fill: ${normalColor} + fill: ${normalColor}; + width: 24px; + height: 24px; + min-height: 24px; + min-width: 24px; } + .popup-listItem:first-child { padding-top: var(--padding); padding-bottom: var(--padding); } + .popup-listItem-message { font-size: 12px; margin: 0; padding: 0 0 6px 0; } + +.popup-listItem--ruleName { + font-size: 12px; + margin: 0 0.5em; +} + .popup-listItem-content { font-size: 16px; /* align icon + text */ @@ -124,6 +136,8 @@ export class TextCheckerPopupElement extends HTMLElement { background-color: ${highLightColor}; } .popup-listItem:hover .popup-listItem--icon { + fill: #ffffff !important; + stroke: #ffffff !important; } `; @@ -167,24 +181,25 @@ export class TextCheckerPopupElement extends HTMLElement { const itemPadding = 16; // TODO: more correct handle const firstLine = state.card.message.split(/\n/)[0]; + const fixIcon = html` + + `; const items = [ state.card.fixable ? { message: firstLine, - label: "Fix it!", + label: html`Fix it!`, onClick: state.handlers?.onFixText, - icon: html` - - ` + icon: fixIcon } : { message: state.card.message @@ -192,45 +207,24 @@ export class TextCheckerPopupElement extends HTMLElement { ...(state.card.fixable ? [ { - label: `Fix this rule: ${state.card.messageRuleId} problems`, + label: html`Fix + ${state.card.messageRuleId} problems`, onClick: state.handlers?.onFixRule, - icon: html` - - ` + icon: fixIcon } ] : []), ...(state.card.fixable ? [ { - label: `Fix all problems`, + label: html`Fix all problems`, onClick: state.handlers?.onFixAll, - icon: html` - - ` + icon: fixIcon } ] : []), { - label: "Ignore", + label: html`Ignore`, onClick: state.handlers?.onIgnore, icon: html` ` }, { - label: "See documentation", + label: html`See documentation`, onClick: state.handlers?.onSeeDocument, icon: html``; // https://www.figma.com/file/9kRm0Cr869zbdACytRE74R/textlint-editor?node-id=4%3A2 - const style = `position: fixed; z-index: 2147483644; width: ${rect.width}px; min-width: 300px; top: ${ + const style = `position: fixed; z-index: 2147483644; min-width: 300px; max-width: 800px; top: ${ rect.top }px; left: ${rect.left - itemPadding}px;`; this.overlay.setAttribute("style", style);