-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Feature tag area #922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature tag area #922
Changes from all commits
8311030
5248c05
3154110
ad0ac19
faede48
06bd2b2
59e5c54
95e237d
c2aa351
8526177
bf9ecb0
2886da4
0ca87ea
e300b33
4689dde
d09de09
3192ce9
e8abd43
ad7a3c4
012e2dd
86270dd
7691b66
d867292
3533903
6018cd5
2fddc32
f805e8a
046e6af
a22e97d
e8564f6
3c4fa83
9b60814
ff4b96b
35beec3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /** | ||
| * @fileoverview Micro component for toggle SideNav | ||
| */ | ||
| import React, { PropTypes } from 'react' | ||
| import styles from './NavToggleButton.styl' | ||
| import CSSModules from 'browser/lib/CSSModules' | ||
|
|
||
| /** | ||
| * @param {boolean} isFolded | ||
| * @param {Function} handleToggleButtonClick | ||
| */ | ||
|
|
||
| const NavToggleButton = ({isFolded, handleToggleButtonClick}) => ( | ||
| <button styleName='navToggle' | ||
| onClick={(e) => handleToggleButtonClick(e)} | ||
| > | ||
| {isFolded | ||
| ? <i className='fa fa-angle-double-right' /> | ||
| : <i className='fa fa-angle-double-left' /> | ||
| } | ||
| </button> | ||
| ) | ||
|
|
||
| NavToggleButton.propTypes = { | ||
| isFolded: PropTypes.bool.isRequired, | ||
| handleToggleButtonClick: PropTypes.func.isRequired | ||
| } | ||
|
|
||
| export default CSSModules(NavToggleButton, styles) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| .navToggle | ||
| navButtonColor() | ||
| display block | ||
| position absolute | ||
| right 5px | ||
| bottom 5px | ||
| border-radius 16.5px | ||
| height 34px | ||
| width 34px | ||
| line-height 32px | ||
| padding 0 | ||
|
|
||
| body[data-theme="dark"] | ||
| .navToggle | ||
| &:hover | ||
| background-color alpha($ui-dark-button--active-backgroundColor, 20%) | ||
| transition 0.15s | ||
| color $ui-dark-text-color | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /** | ||
| * @fileoverview Micro component for showing StorageList | ||
| */ | ||
| import React, { PropTypes } from 'react' | ||
| import styles from './StorgaeList.styl' | ||
| import CSSModules from 'browser/lib/CSSModules' | ||
|
|
||
| /** | ||
| * @param {Array} storgaeList | ||
| */ | ||
|
|
||
| const StorageList = ({storageList}) => ( | ||
| <div styleName='storageList'> | ||
| {storageList.length > 0 ? storageList : ( | ||
| <div styleName='storgaeList-empty'>No storage mount.</div> | ||
| )} | ||
| </div> | ||
| ) | ||
|
|
||
| StorageList.propTypes = { | ||
| storgaeList: PropTypes.arrayOf(PropTypes.element).isRequired | ||
| } | ||
| export default CSSModules(StorageList, styles) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| .storageList | ||
| absolute left right | ||
| bottom 37px | ||
| top 160px | ||
| overflow-y auto | ||
|
|
||
| .storageList-empty | ||
| padding 0 10px | ||
| margin-top 15px | ||
| line-height 24px | ||
| color $ui-inactive-text-color | ||
|
|
||
| body[data-theme="dark"] | ||
| .storageList-empty | ||
| color $ui-dark-inactive-text-color | ||
|
|
||
| .root-folded | ||
| .storageList-empty | ||
| white-space nowrap | ||
| transform rotate(90deg) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /** | ||
| * @fileoverview Micro component for showing TagList. | ||
| */ | ||
| import React, { PropTypes } from 'react' | ||
| import styles from './TagListItem.styl' | ||
| import CSSModules from 'browser/lib/CSSModules' | ||
|
|
||
| /** | ||
| * @param {string} name | ||
| * @param {Function} handleClickTagListItem | ||
| * @param {bool} isActive | ||
| */ | ||
|
|
||
| const TagListItem = ({name, handleClickTagListItem, isActive}) => ( | ||
| <button styleName={isActive ? 'tagList-item-active' : 'tagList-item'} onClick={() => handleClickTagListItem(name)}> | ||
| <span styleName='tagList-item-name'> | ||
| {`# ${name}`} | ||
| </span> | ||
| </button> | ||
| ) | ||
|
|
||
| TagListItem.propTypes = { | ||
| name: PropTypes.string.isRequired, | ||
| handleClickTagListItem: PropTypes.func.isRequired | ||
| } | ||
|
|
||
| export default CSSModules(TagListItem, styles) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| .tagList-item | ||
| display flex | ||
| width 100% | ||
| height 26px | ||
| background-color transparent | ||
| color $ui-inactive-text-color | ||
| padding 0 | ||
| margin-bottom 5px | ||
| text-align left | ||
| border none | ||
| overflow ellipsis | ||
| font-size 12px | ||
| &:first-child | ||
| margin-top 0 | ||
| &:hover | ||
| color $ui-text-color | ||
| background-color alpha($ui-button--active-backgroundColor, 20%) | ||
| transition background-color 0.15s | ||
| &:active | ||
| color $ui-text-color | ||
| background-color $ui-button--active-backgroundColor | ||
|
|
||
| .tagList-item-active | ||
| background-color $ui-button--active-backgroundColor | ||
| display flex | ||
| width 100% | ||
| height 26px | ||
| padding 0 | ||
| margin-bottom 5px | ||
| text-align left | ||
| border none | ||
| overflow ellipsis | ||
| font-size 12px | ||
|
|
||
| .tagList-item-name | ||
| display block | ||
| flex 1 | ||
| padding 0 25px | ||
| height 26px | ||
| line-height 26px | ||
| border-width 0 0 0 2px | ||
| border-style solid | ||
| border-color transparent | ||
| overflow hidden | ||
| text-overflow ellipsis |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,7 +229,7 @@ class NoteList extends React.Component { | |
| let { data, params, location } = this.props | ||
| let { router } = this.context | ||
|
|
||
| if (location.pathname.match(/\/home/)) { | ||
| if (location.pathname.match(/\/home/) || location.pathname.match(/\alltags/)) { | ||
| const allNotes = data.noteMap.map((note) => note) | ||
| this.contextNotes = allNotes | ||
| return allNotes | ||
|
|
@@ -255,6 +255,14 @@ class NoteList extends React.Component { | |
| return trashedNotes | ||
| } | ||
|
|
||
| if (location.pathname.match(/\/tags/)) { | ||
| return data.noteMap.map(note => { | ||
| return note | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that note was not edit. Is it necessary?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😢 |
||
| }).filter(note => { | ||
| return note.tags.includes(params.tagname) | ||
| }) | ||
| } | ||
|
|
||
| return this.getContextNotes() | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PropTypesis not used in this file.Let's use it.
handleClickTagListItemis a little bit complicated, so declaration type for it will help us to understand.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's true.
I forgot to use it ... I will modify it to use it.