mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
refactor: cut down the component from SideNav component
This commit is contained in:
41
browser/components/SideNavFilter.js
Normal file
41
browser/components/SideNavFilter.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @fileoverview Filter for all notes.
|
||||
*/
|
||||
import React, { PropTypes } from 'react'
|
||||
import CSSModules from 'browser/lib/CSSModules'
|
||||
import styles from './SideNavFilter.styl'
|
||||
|
||||
/**
|
||||
* @param {boolean} isHomeActive
|
||||
* @param {Function} handleAllNotesButtonClick
|
||||
* @param {boolean} isStarredActive
|
||||
* @param {Function} handleStarredButtonClick
|
||||
* @return {React.Component}
|
||||
*/
|
||||
const SideNavFilter = ({
|
||||
isHomeActive, handleAllNotesButtonClick, isStarredActive, handleStarredButtonClick
|
||||
}) => (
|
||||
<div styleName='menu'>
|
||||
<button styleName={isHomeActive ? 'menu-button--active' : 'menu-button'}
|
||||
onClick={handleAllNotesButtonClick}
|
||||
>
|
||||
<i className='fa fa-book fa-fw'/>
|
||||
<span styleName='menu-button-label'>All Notes</span>
|
||||
</button>
|
||||
<button styleName={isStarredActive ? 'menu-button--active' : 'menu-button'}
|
||||
onClick={handleStarredButtonClick}
|
||||
>
|
||||
<i className='fa fa-star fa-fw'/>
|
||||
<span styleName='menu-button-label'>Starred</span>
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
|
||||
SideNavFilter.propTypes = {
|
||||
isHomeActive: PropTypes.bool.isRequired,
|
||||
handleAllNotesButtonClick: PropTypes.func.isRequired,
|
||||
isStarredActive: PropTypes.bool.isRequired,
|
||||
handleStarredButtonClick: PropTypes.func.isRequired,
|
||||
}
|
||||
|
||||
export default CSSModules(SideNavFilter, styles)
|
||||
32
browser/components/SideNavFilter.styl
Normal file
32
browser/components/SideNavFilter.styl
Normal file
@@ -0,0 +1,32 @@
|
||||
.menu
|
||||
margin-bottom 30px
|
||||
|
||||
.menu-button
|
||||
navButtonColor()
|
||||
height 32px
|
||||
padding 0 15px
|
||||
font-size 14px
|
||||
width 100%
|
||||
text-align left
|
||||
overflow ellipsis
|
||||
|
||||
.menu-button--active
|
||||
@extend .menu-button
|
||||
background-color $ui-button--active-backgroundColor
|
||||
color $ui-button--active-color
|
||||
&:hover
|
||||
background-color $ui-button--active-backgroundColor
|
||||
|
||||
.menu-button-label
|
||||
margin-left 5px
|
||||
|
||||
body[data-theme="dark"]
|
||||
.menu-button
|
||||
navDarkButtonColor()
|
||||
|
||||
.menu-button--active
|
||||
@extend .menu-button
|
||||
background-color $ui-dark-button--active-backgroundColor
|
||||
color $ui-dark-button--active-color
|
||||
&:hover
|
||||
background-color $ui-dark-button--active-backgroundColor
|
||||
Reference in New Issue
Block a user