1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

change layout

This commit is contained in:
Dick Choi
2016-07-19 13:29:05 +09:00
parent af7476f79a
commit f36f2029e5
7 changed files with 85 additions and 139 deletions

View File

@@ -94,18 +94,18 @@ class Main extends React.Component {
'location' 'location'
])} ])}
/> />
<TopBar
{..._.pick(this.props, [
'dispatch',
'storages',
'config',
'params',
'location'
])}
/>
<div styleName={config.isSideNavFolded ? 'body--expanded' : 'body'} <div styleName={config.isSideNavFolded ? 'body--expanded' : 'body'}
ref='body' ref='body'
> >
<TopBar style={{width: this.state.listWidth}}
{..._.pick(this.props, [
'dispatch',
'storages',
'config',
'params',
'location'
])}
/>
<NoteList style={{width: this.state.listWidth}} <NoteList style={{width: this.state.listWidth}}
{..._.pick(this.props, [ {..._.pick(this.props, [
'dispatch', 'dispatch',

View File

@@ -2,9 +2,8 @@
absolute top left bottom right absolute top left bottom right
.body .body
absolute right absolute right top
bottom $statusBar-height - 1 bottom $statusBar-height - 1
top $topBar-height - 1
left $sideNav-width left $sideNav-width
.body--expanded .body--expanded

View File

@@ -1,8 +1,9 @@
.root .root
absolute top left bottom absolute left bottom
border-top $ui-border border-top $ui-border
border-bottom $ui-border border-bottom $ui-border
overflow auto overflow auto
top $topBar-height - 1
.item .item
position relative position relative

View File

@@ -9,12 +9,12 @@
color $ui-text-color color $ui-text-color
.top .top
height 60px height $topBar-height
border-bottom $ui-border border-bottom $ui-border
.top-menu .top-menu
navButtonColor() navButtonColor()
height 59px height $topBar-height - 1
padding 0 10px padding 0 10px
font-size 14px font-size 14px
width 100% width 100%

View File

@@ -1,55 +1,50 @@
.root .root
absolute top right
background-color $ui-backgroundColor
left $sideNav-width
height $topBar-height -1
clearfix()
.left
float left
height $topBar-height - 1
line-height $topBar-height
.left-search
margin-top 12px
margin-left 25px
height 34px
width 200px
float left
border-radius 22px
position relative position relative
background-color white width 100%
border $ui-border background-color $ui-backgroundColor
height $topBar-height - 1
.left-search-icon $control-height = 34px
absolute left
width 36px .control
height 32px position absolute
padding 0 top 8px
left 8px
right 8px
height $control-height
border $ui-border
border-radius 20px
overflow hidden
.control-search
absolute top left bottom
right 40px
background-color white
.control-search-icon
absolute top bottom left
line-height 32px line-height 32px
width 35px
color $ui-inactive-text-color color $ui-inactive-text-color
.left-search-input .control-search-input
display block
absolute top bottom right absolute top bottom right
height 32px left 30px
left 34px input
border none width 100%
outline none height 100%
font-size 14px outline none
border none
.left-control .control-newPostButton
float left display block
margin-left 15px absolute top right bottom
width 40px
.left-control-newPostButton height $control-height - 2
width 34px
height 34px
margin-top 12px
border-radius 17px
navButtonColor() navButtonColor()
border $ui-border border-left $ui-border
font-size 14px font-size 14px
line-height 32px line-height 28px
padding 0 padding 0
&:active &:active
border-color $ui-button--active-backgroundColor border-color $ui-button--active-backgroundColor
@@ -57,7 +52,7 @@
display block display block
.left-control-newPostButton-tooltip .control-newPostButton-tooltip
position fixed position fixed
line-height 1.4 line-height 1.4
background-color $ui-tooltip-backgroundColor background-color $ui-tooltip-backgroundColor
@@ -70,39 +65,3 @@
border-radius 5px border-radius 5px
display none display none
pointer-events none pointer-events none
.right
float right
height $topBar-height -1
clearfix()
.right-helpButton
width 24px
height 24px
border-radius 12px
navButtonColor()
border $ui-border
line-height 22px
font-size 12px
padding 0
float left
margin-top 17px
.right-linksButton
float left
height 44px
width 44px
border-radius 17px
background-color transparent
border none
margin-top 7px
margin-left 5px
margin-right 15px
opacity 0.8
&:hover, &:active
opacity 1
.root--expanded
@extend .root
absolute top right
left $sideNav--folded-width

View File

@@ -5,6 +5,8 @@ import activityRecord from 'browser/lib/activityRecord'
import _ from 'lodash' import _ from 'lodash'
import Commander from 'browser/main/lib/Commander' import Commander from 'browser/main/lib/Commander'
import dataApi from 'browser/main/lib/dataApi' import dataApi from 'browser/main/lib/dataApi'
import modal from 'browser/main/lib/modal'
import NewNoteModal from 'browser/main/modals/NewNoteModal'
const OSX = window.process.platform === 'darwin' const OSX = window.process.platform === 'darwin'
@@ -33,49 +35,46 @@ class TopBar extends React.Component {
} }
handleNewPostButtonClick (e) { handleNewPostButtonClick (e) {
let { storages, params, dispatch } = this.props let { storages, params, dispatch, location } = this.props
let storage = _.find(storages, {key: params.storageKey}) let storage = _.find(storages, {key: params.storageKey})
if (storage == null) storage = storages[0] if (storage == null) storage = storages[0]
if (storage == null) throw new Error('No storage to create a note') if (storage == null) throw new Error('No storage to create a note')
let folder = _.find(storage.folders, {key: params.folderKey}) let folder = _.find(storage.folders, {key: params.folderKey})
if (folder == null) folder = storage.folders[0] if (folder == null) folder = storage.folders[0]
if (folder == null) throw new Error('No folder to craete a note') if (folder == null) throw new Error('No folder to craete a note')
// activityRecord.emit('ARTICLE_CREATE')
console.log(storage, folder) modal.open(NewNoteModal, {
dataApi storage: storage.key,
.createNote(storage.key, folder.key, { folder: folder.key,
title: '', dispatch,
content: '' location
}) })
.then((note) => {
dispatch({
type: 'CREATE_NOTE',
note: note
})
})
} }
handleTutorialButtonClick (e) { handleTutorialButtonClick (e) {
} }
render () { render () {
let { config } = this.props let { config, style } = this.props
return ( return (
<div className='TopBar' <div className='TopBar'
styleName={config.isSideNavFolded ? 'root--expanded' : 'root'} styleName={config.isSideNavFolded ? 'root--expanded' : 'root'}
style={style}
> >
<div styleName='left'> <div styleName='control'>
<div styleName='left-search'> <div styleName='control-search'>
<i styleName='left-search-icon' className='fa fa-search fa-fw'/> <i styleName='control-search-icon' className='fa fa-search fa-fw'/>
<input styleName='left-search-input' <div styleName='control-search-input'>
ref='searchInput' <input
onFocus={(e) => this.handleSearchChange(e)} ref='searchInput'
onBlur={(e) => this.handleSearchChange(e)} onFocus={(e) => this.handleSearchChange(e)}
value={this.state.search} onBlur={(e) => this.handleSearchChange(e)}
onChange={(e) => this.handleSearchChange(e)} value={this.state.search}
placeholder='Search' onChange={(e) => this.handleSearchChange(e)}
type='text' placeholder='Search'
/> type='text'
/>
</div>
{this.state.search > 0 && {this.state.search > 0 &&
<button styleName='left-search-clearButton' <button styleName='left-search-clearButton'
onClick={(e) => this.handleSearchClearButton(e)} onClick={(e) => this.handleSearchClearButton(e)}
@@ -83,27 +82,15 @@ class TopBar extends React.Component {
<i className='fa fa-times'/> <i className='fa fa-times'/>
</button> </button>
} }
</div>
<div styleName='left-control'>
<button styleName='left-control-newPostButton'
onClick={(e) => this.handleNewPostButtonClick(e)}>
<i className='fa fa-plus'/>
<span styleName='left-control-newPostButton-tooltip'>
New Note {OSX ? '⌘' : '^'} + n
</span>
</button>
</div> </div>
</div> <button styleName='control-newPostButton'
onClick={(e) => this.handleNewPostButtonClick(e)}>
<div styleName='right'> <i className='fa fa-plus'/>
<button styleName='right-helpButton' <span styleName='control-newPostButton-tooltip'>
onClick={(e) => this.handleTutorialButtonClick(e)} New Note {OSX ? '⌘' : '^'} + n
disabled </span>
>
?<span styleName='left-control-newPostButton-tooltip'>How to use</span>
</button> </button>
</div> </div>
</div> </div>
) )

View File

@@ -7,7 +7,7 @@ $danger-lighten-color = lighten(#c9302c, 5%)
$statusBar-height = 24px $statusBar-height = 24px
$sideNav-width = 200px $sideNav-width = 200px
$sideNav--folded-width = 44px $sideNav--folded-width = 44px
$topBar-height = 60px $topBar-height = 50px
// UI default // UI default
$ui-text-color = #515151 $ui-text-color = #515151