1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

tags are clickable

This commit is contained in:
Baptiste Augrain
2018-09-05 18:08:47 +02:00
parent fdfa3bb8f5
commit ac71093888
2 changed files with 14 additions and 4 deletions

View File

@@ -99,6 +99,11 @@ class TagSelect extends React.Component {
}) })
} }
handleTagLabelClick (tag) {
const { router } = this.context
router.push(`/tags/${tag}`)
}
handleTagRemoveButtonClick (tag) { handleTagRemoveButtonClick (tag) {
this.removeTagByCallback((value, tag) => { this.removeTagByCallback((value, tag) => {
value.splice(value.indexOf(tag), 1) value.splice(value.indexOf(tag), 1)
@@ -127,7 +132,7 @@ class TagSelect extends React.Component {
<span styleName='tag' <span styleName='tag'
key={tag} key={tag}
> >
<span styleName='tag-label'>#{tag}</span> <span styleName='tag-label' onClick={(e) => this.handleTagLabelClick(tag)}>#{tag}</span>
<button styleName='tag-removeButton' <button styleName='tag-removeButton'
onClick={(e) => this.handleTagRemoveButtonClick(tag)} onClick={(e) => this.handleTagRemoveButtonClick(tag)}
> >
@@ -159,6 +164,10 @@ class TagSelect extends React.Component {
} }
} }
TagSelect.contextTypes = {
router: PropTypes.shape({})
}
TagSelect.propTypes = { TagSelect.propTypes = {
className: PropTypes.string, className: PropTypes.string,
value: PropTypes.arrayOf(PropTypes.string), value: PropTypes.arrayOf(PropTypes.string),

View File

@@ -39,8 +39,9 @@
.tag-label .tag-label
font-size 13px font-size 13px
color: $ui-text-color color $ui-text-color
padding 4px 16px 4px 8px padding 4px 16px 4px 8px
cursor pointer
.newTag .newTag
box-sizing border-box box-sizing border-box