diff --git a/browser/main/Detail/NoteDetail.js b/browser/main/Detail/NoteDetail.js index b0b55f7d..b6b1a737 100644 --- a/browser/main/Detail/NoteDetail.js +++ b/browser/main/Detail/NoteDetail.js @@ -3,6 +3,7 @@ import CSSModules from 'browser/lib/CSSModules' import styles from './NoteDetail.styl' import MarkdownEditor from 'browser/components/MarkdownEditor' import queue from 'browser/main/lib/queue' +import TagSelect from './TagSelect' class NoteDetail extends React.Component { constructor (props) { @@ -15,9 +16,6 @@ class NoteDetail extends React.Component { this.dispatchTimer = null } - componentDidUpdate (prevProps, prevState) { - } - componentWillReceiveProps (nextProps) { if (nextProps.note.key !== this.props.note.key) { if (this.state.isDispatchQueued) { @@ -28,6 +26,7 @@ class NoteDetail extends React.Component { isDispatchQueued: false }, () => { this.refs.content.reload() + this.refs.tags.reset() }) } } @@ -64,6 +63,7 @@ class NoteDetail extends React.Component { let { note } = this.state note.content = this.refs.content.value + note.tags = this.refs.tags.value this.setState({ note, @@ -114,8 +114,21 @@ class NoteDetail extends React.Component { >
-
FOLDER SELECT
-
TAG SELECT
+ +
+ +
FolderSelect
+
+
+ this.handleChange(e)} + /> +
+ {tag} + + ) + }) + + return ( +
+ + {tagList} + this.handleNewTagInputChange(e)} + onKeyDown={(e) => this.handleNewTagInputKeyDown(e)} + /> + +
+ ) + } +} + +TagSelect.propTypes = { + className: PropTypes.string, + value: PropTypes.arrayOf(PropTypes.string).isRequired, + onChange: PropTypes.func + +} + +export default CSSModules(TagSelect, styles) diff --git a/browser/main/Detail/TagSelect.styl b/browser/main/Detail/TagSelect.styl new file mode 100644 index 00000000..2b82d459 --- /dev/null +++ b/browser/main/Detail/TagSelect.styl @@ -0,0 +1,66 @@ +.root + position relative + line-height 40px + user-select none + +.icon + display inline-block + width 30px + line-height 40px + vertical-align top + text-align center + +.tag + display inline-block + margin 0 2px + vertical-align middle + height 20px + clearfix() + +.tag-removeButton + float left + height 20px + width 18px + margin 0 + padding 0 + border $ui-border + border-top-left-radius 5px + border-bottom-left-radius 5px + line-height 18px + background-color transparent + color $ui-button-color + &:hover + background-color $ui-button--hover-backgroundColor + &:active, &:active:hover + color $ui-button--active-color + background-color $ui-button--active-backgroundColor + border-color $ui-button--focus-borderColor + &:focus + border-color $ui-button--focus-borderColor + +.tag-label + float left + height 20px + line-height 18px + border-top $ui-border + border-right $ui-border + border-bottom $ui-border + border-top-right-radius 5px + border-bottom-right-radius 5px + padding 0 6px + +.newTag + display inline-block + margin 0 2px + vertical-align middle + height 24px + box-sizing borde-box + border none + border-bottom $ui-border + background-color transparent + outline none + padding 0 4px + &:focus + border-color $ui-input--focus-borderColor = #369DCD + &:disabled + background-color $ui-input--disabled-backgroundColor = #DDD diff --git a/browser/styles/index.styl b/browser/styles/index.styl index db3636a7..2a809e97 100644 --- a/browser/styles/index.styl +++ b/browser/styles/index.styl @@ -22,6 +22,7 @@ $ui-button-color = #939395 $ui-button--hover-backgroundColor = rgba(126, 127, 129, 0.08) $ui-button--active-color = white $ui-button--active-backgroundColor = #6AA5E9 +$ui-button--focus-borderColor = lighten(#369DCD, 25%) // UI Tooltip $ui-tooltip-text-color = white