diff --git a/web/app/@types/markdown-toolbar-element/index.d.ts b/web/app/@types/markdown-toolbar-element/index.d.ts index 05975635..d5eaab75 100644 --- a/web/app/@types/markdown-toolbar-element/index.d.ts +++ b/web/app/@types/markdown-toolbar-element/index.d.ts @@ -1,6 +1,10 @@ declare namespace JSX { interface IntrinsicElements { - 'markdown-toolbar': any; + 'markdown-toolbar': { + for: string; + children?: any; + }; 'md-bold': any; + 'md-header': any; } } diff --git a/web/app/components/input/__control-panel/input__control-panel.scss b/web/app/components/input/__control-panel/input__control-panel.scss new file mode 100644 index 00000000..dbe5e17b --- /dev/null +++ b/web/app/components/input/__control-panel/input__control-panel.scss @@ -0,0 +1,4 @@ +.input__control-panel { + height: 30px; + background-color: #eee; +} diff --git a/web/app/components/input/__markdown-toolbar/input__markdown-toolbar.scss b/web/app/components/input/__markdown-toolbar/input__markdown-toolbar.scss index 2a12d439..7db3f8ba 100644 --- a/web/app/components/input/__markdown-toolbar/input__markdown-toolbar.scss +++ b/web/app/components/input/__markdown-toolbar/input__markdown-toolbar.scss @@ -1,11 +1,31 @@ markdown-toolbar { display: block; - font-size: 16px; - line-height: 1.2; - border: 1px dashed; - border-radius: 2px; + float: right; } -md-bold { +.input__toolbar-item { + background: none; + border: 0; + color: #586069; display: block; + float: left; + padding: 4px 5px; + + &:hover { + color: #0aa; + } +} + +.input__toolbar-icon { + display: inline-block; + fill: currentColor; +} + +.input__toolbar-group { + display: inline-block; + margin-left: 20px; +} + +.input__toolbar-group:first-child { + margin-left: 0; } diff --git a/web/app/components/input/_theme/_dark/input_theme_dark.scss b/web/app/components/input/_theme/_dark/input_theme_dark.scss index 252cb424..11d52051 100644 --- a/web/app/components/input/_theme/_dark/input_theme_dark.scss +++ b/web/app/components/input/_theme/_dark/input_theme_dark.scss @@ -35,4 +35,15 @@ .input__preview-wrapper { background: #eee; } + + .input__toolbar-item { + color: #ddd; + &:hover { + color: #0aa; + } + } + + .input__control-panel { + background-color: #333; + } } diff --git a/web/app/components/input/input.scss b/web/app/components/input/input.scss index 062b7960..8d43f7a6 100644 --- a/web/app/components/input/input.scss +++ b/web/app/components/input/input.scss @@ -2,6 +2,7 @@ position: relative; display: block; font-size: 0; - border: 12px solid; + border-style: solid; + border-width: 6px 12px 12px 12px; border-radius: 2px; } diff --git a/web/app/components/input/input.tsx b/web/app/components/input/input.tsx index a961eef8..d820b7a8 100644 --- a/web/app/components/input/input.tsx +++ b/web/app/components/input/input.tsx @@ -2,7 +2,6 @@ /* styles imports */ import '@app/components/raw-content'; -import '@github/markdown-toolbar-element'; import './styles'; import { h, Component, RenderableProps } from 'preact'; @@ -14,6 +13,7 @@ import { StaticStore } from '@app/common/static_store'; import { siteId, url, pageTitle } from '@app/common/settings'; import { extractErrorMessageFromResponse } from '@app/utils/errorUtils'; +import MarkdownToolbar from './markdown-toolbar'; import TextareaAutosize from './textarea-autosize'; const RSS_THREAD_URL = `${BASE_URL}${API_BASE}/rss/post?site=${siteId}&url=${url}`; @@ -169,10 +169,10 @@ export class Input extends Component { onSubmit={this.send} aria-label="New comment" > +
+ +
- - bold - (this.textAreaRef = ref)} diff --git a/web/app/components/input/markdown-toolbar-icons/bold-icon.tsx b/web/app/components/input/markdown-toolbar-icons/bold-icon.tsx new file mode 100644 index 00000000..67575103 --- /dev/null +++ b/web/app/components/input/markdown-toolbar-icons/bold-icon.tsx @@ -0,0 +1,13 @@ +/** @jsx h */ +import { h } from 'preact'; + +export default function BoldIcon() { + return ( + + ); +} diff --git a/web/app/components/input/markdown-toolbar-icons/header-icon.tsx b/web/app/components/input/markdown-toolbar-icons/header-icon.tsx new file mode 100644 index 00000000..73be26a6 --- /dev/null +++ b/web/app/components/input/markdown-toolbar-icons/header-icon.tsx @@ -0,0 +1,13 @@ +/** @jsx h */ +import { h } from 'preact'; + +export default function HeaderIcon() { + return ( + + ); +} diff --git a/web/app/components/input/markdown-toolbar.tsx b/web/app/components/input/markdown-toolbar.tsx new file mode 100644 index 00000000..40183ebf --- /dev/null +++ b/web/app/components/input/markdown-toolbar.tsx @@ -0,0 +1,29 @@ +/** @jsx h */ +import { h, Component, RenderableProps } from 'preact'; +import '@github/markdown-toolbar-element'; +import BoldIcon from './markdown-toolbar-icons/bold-icon'; +import HeaderIcon from './markdown-toolbar-icons/header-icon'; + +interface Props { + textareaId: string; +} + +const boldLabel = 'Add bold text '; +const headerLabel = 'Add header text'; + +export default class MarkdownToolbar extends Component { + render(props: RenderableProps) { + return ( + +
+ + + + + + +
+
+ ); + } +} diff --git a/web/app/components/input/styles.ts b/web/app/components/input/styles.ts index c05c2f15..450bcf82 100644 --- a/web/app/components/input/styles.ts +++ b/web/app/components/input/styles.ts @@ -8,6 +8,7 @@ require('./__button/input__button.scss'); require('./__button/_type/_preview/input__button_type_preview.scss'); require('./__button/_type/_send/input__button_type_send.scss'); +require('./__control-panel/input__control-panel.scss'); require('./__counter/input__counter.scss'); require('./__error/input__error.scss'); require('./__field/input__field.scss');