Skip to content
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

added tooltips like the new note button #1321

Merged
merged 1 commit into from
Dec 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions browser/main/Detail/FullscreenButton.js
@@ -0,0 +1,19 @@
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './FullscreenButton.styl'

const FullscreenButton = ({
onClick
}) => (
<button styleName='control-fullScreenButton' title='Fullscreen' onMouseDown={(e) => onClick(e)}>
<img styleName='iconInfo' src='../resources/icon/icon-full.svg' />
<span styleName='tooltip'>Fullscreen</span>
</button>
)

FullscreenButton.propTypes = {
onClick: PropTypes.func.isRequired
}

export default CSSModules(FullscreenButton, styles)
22 changes: 22 additions & 0 deletions browser/main/Detail/FullscreenButton.styl
@@ -0,0 +1,22 @@
.control-fullScreenButton
top 80px
topBarButtonRight()
&:hover .tooltip
opacity 1

.tooltip
tooltip()
position absolute
pointer-events none
top 26px
right 0
z-index 200
padding 5px
line-height normal
border-radius 2px
opacity 0
transition 0.1s

body[data-theme="dark"]
.control-fullScreenButton
topBarButtonDark()
1 change: 1 addition & 0 deletions browser/main/Detail/InfoButton.js
Expand Up @@ -10,6 +10,7 @@ const InfoButton = ({
onClick={(e) => onClick(e)}
>
<img className='infoButton' src='../resources/icon/icon-info.svg' />
<span styleName='tooltip'>Info</span>
</button>
)

Expand Down
15 changes: 15 additions & 0 deletions browser/main/Detail/InfoButton.styl
@@ -1,6 +1,21 @@
.control-infoButton
top 10px
topBarButtonRight()
&:hover .tooltip
opacity 1

.tooltip
tooltip()
position absolute
pointer-events none
top 26px
right 0
z-index 200
padding 5px
line-height normal
border-radius 2px
opacity 0
transition 0.1s

.infoButton
padding 0px
Expand Down
21 changes: 5 additions & 16 deletions browser/main/Detail/MarkdownNoteDetail.js
Expand Up @@ -18,8 +18,10 @@ import { findNoteTitle } from 'browser/lib/findNoteTitle'
import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig'
import ConfigManager from 'browser/main/lib/ConfigManager'
import TrashButton from './TrashButton'
import FullscreenButton from './FullscreenButton'
import PermanentDeleteButton from './PermanentDeleteButton'
import InfoButton from './InfoButton'
import ToggleModeButton from './ToggleModeButton'
import InfoPanel from './InfoPanel'
import InfoPanelTrashed from './InfoPanelTrashed'
import { formatDate } from 'browser/lib/date-formatter'
Expand Down Expand Up @@ -355,18 +357,9 @@ class MarkdownNoteDetail extends React.Component {
onChange={(e) => this.handleChange(e)}
/>

<div styleName='mode-tab'>
<div styleName={editorType === 'SPLIT' ? 'active' : 'non-active'} onClick={() => this.handleSwitchMode('SPLIT')}>
<img styleName='item-star' src={editorType === 'EDITOR_PREVIEW' ? '../resources/icon/icon-mode-split-on.svg' : '../resources/icon/icon-mode-split-on-active.svg'} />
</div>
<div styleName={editorType === 'EDITOR_PREVIEW' ? 'active' : 'non-active'} onClick={() => this.handleSwitchMode('EDITOR_PREVIEW')}>
<img styleName='item-star' src={editorType === 'EDITOR_PREVIEW' ? '../resources/icon/icon-mode-markdown-off-active.svg' : '../resources/icon/icon-mode-markdown-off.svg'} />
</div>
</div>
<ToggleModeButton onClick={(e) => this.handleSwitchMode(e)} editorType={editorType} />

<TodoListPercentage
percentageOfTodo={getTodoPercentageOfCompleted(note.content)}
/>
<TodoListPercentage percentageOfTodo={getTodoPercentageOfCompleted(note.content)} />
</div>
<div styleName='info-right'>
<InfoButton
Expand All @@ -393,11 +386,7 @@ class MarkdownNoteDetail extends React.Component {
)
})()}

<button styleName='control-fullScreenButton'
onMouseDown={(e) => this.handleFullScreenButton(e)}
>
<img styleName='iconInfo' src='../resources/icon/icon-full.svg' />
</button>
<FullscreenButton onClick={(e) => this.handleFullScreenButton(e)} />

<TrashButton onClick={(e) => this.handleTrashButtonClick(e)} />

Expand Down
24 changes: 0 additions & 24 deletions browser/main/Detail/MarkdownNoteDetail.styl
Expand Up @@ -19,10 +19,6 @@
top 40px
position relative

.control-fullScreenButton
top 80px
topBarButtonRight()

.body
absolute left right
left 0
Expand All @@ -32,26 +28,6 @@
margin 0 45px
.body-noteEditor
absolute top bottom left right

.mode-tab
border 1px solid #eee
height 34px
display flex
align-items center
div
width 40px
height 100%
background-color #f9f9f9
display flex
align-items center
justify-content center
cursor pointer
&:first-child
border-right 1px solid #eee
.active
background-color #fff
box-shadow 2px 0px 7px #eee
z-index 1

body[data-theme="white"]
.root
Expand Down
1 change: 1 addition & 0 deletions browser/main/Detail/PermanentDeleteButton.js
Expand Up @@ -10,6 +10,7 @@ const PermanentDeleteButton = ({
onClick={(e) => onClick(e)}
>
<img styleName='iconInfo' src='../resources/icon/icon-trash.svg' />
<span styleName='tooltip'>Permanent Delete</span>
</button>
)

Expand Down
2 changes: 1 addition & 1 deletion browser/main/Detail/SnippetNoteDetail.js
Expand Up @@ -634,7 +634,7 @@ class SnippetNoteDetail extends React.Component {
isActive={note.isStarred}
/>

<button styleName='control-fullScreenButton'
<button styleName='control-fullScreenButton' title='Fullscreen'
onMouseDown={(e) => this.handleFullScreenButton(e)}>
<img styleName='iconInfo' src='../resources/icon/icon-sidebar.svg' />
</button>
Expand Down
4 changes: 2 additions & 2 deletions browser/main/Detail/StarButton.js
Expand Up @@ -46,14 +46,14 @@ class StarButton extends React.Component {
onMouseDown={(e) => this.handleMouseDown(e)}
onMouseUp={(e) => this.handleMouseUp(e)}
onMouseLeave={(e) => this.handleMouseLeave(e)}
onClick={this.props.onClick}
>
onClick={this.props.onClick}>
<img styleName='icon'
src={this.state.isActive || this.props.isActive
? '../resources/icon/icon-starred.svg'
: '../resources/icon/icon-star.svg'
}
/>
<span styleName='tooltip'>Star</span>
</button>
)
}
Expand Down
16 changes: 16 additions & 0 deletions browser/main/Detail/StarButton.styl
Expand Up @@ -4,6 +4,22 @@
&:hover
transition 0.2s
color alpha($ui-favorite-star-button-color, 0.6)
&:hover .tooltip
opacity 1

.tooltip
tooltip()
position absolute
pointer-events none
top 26px
right 0
width 100%
z-index 200
padding 5px
line-height normal
border-radius 2px
opacity 0
transition 0.1s

.root--active
@extend .root
Expand Down
25 changes: 25 additions & 0 deletions browser/main/Detail/ToggleModeButton.js
@@ -0,0 +1,25 @@
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './ToggleModeButton.styl'

const ToggleModeButton = ({
onClick, editorType
}) => (
<div styleName='control-toggleModeButton'>
<div styleName={editorType === 'SPLIT' ? 'active' : 'non-active'} onClick={() => onClick('SPLIT')}>
<img styleName='item-star' src={editorType === 'EDITOR_PREVIEW' ? '../resources/icon/icon-mode-split-on.svg' : '../resources/icon/icon-mode-split-on-active.svg'} />
</div>
<div styleName={editorType === 'EDITOR_PREVIEW' ? 'active' : 'non-active'} onClick={() => onClick('EDITOR_PREVIEW')}>
<img styleName='item-star' src={editorType === 'EDITOR_PREVIEW' ? '../resources/icon/icon-mode-markdown-off-active.svg' : '../resources/icon/icon-mode-markdown-off.svg'} />
</div>
<span styleName='tooltip'>Toggle Mode</span>
</div>
)

ToggleModeButton.propTypes = {
onClick: PropTypes.func.isRequired,
editorType: PropTypes.string.Required
}

export default CSSModules(ToggleModeButton, styles)
41 changes: 41 additions & 0 deletions browser/main/Detail/ToggleModeButton.styl
@@ -0,0 +1,41 @@
.control-toggleModeButton

border 1px solid #eee
height 34px
display flex
align-items center

div
width 40px
height 100%
background-color #f9f9f9
display flex
align-items center
justify-content center
cursor pointer

&:first-child
border-right 1px solid #eee
.active
background-color #fff
box-shadow 2px 0px 7px #eee
z-index 1
&:hover .tooltip
opacity 1

.tooltip
tooltip()
position absolute
pointer-events none
top 47px
right 11px
z-index 200
padding 5px
line-height normal
border-radius 2px
opacity 0
transition 0.1s

body[data-theme="dark"]
.control-fullScreenButton
topBarButtonDark()
1 change: 1 addition & 0 deletions browser/main/Detail/TrashButton.js
Expand Up @@ -10,6 +10,7 @@ const TrashButton = ({
onClick={(e) => onClick(e)}
>
<img styleName='iconInfo' src='../resources/icon/icon-trash.svg' />
<span styleName='tooltip'>Trash</span>
</button>
)

Expand Down
15 changes: 15 additions & 0 deletions browser/main/Detail/TrashButton.styl
@@ -1,6 +1,21 @@
.control-trashButton
top 115px
topBarButtonRight()
&:hover .tooltip
opacity 1

.tooltip
tooltip()
position absolute
pointer-events none
top 26px
right 0
z-index 200
padding 5px
line-height normal
border-radius 2px
opacity 0
transition 0.1s

.control-trashButton--in-trash
top 60px
Expand Down
24 changes: 24 additions & 0 deletions browser/main/SideNav/ListButton.js
@@ -0,0 +1,24 @@
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './SwitchButton.styl'

const ListButton = ({
onClick, isTagActive
}) => (
<button styleName={isTagActive ? 'non-active-button' : 'active-button'} onClick={onClick}>
<img src={isTagActive
? '../resources/icon/icon-list.svg'
: '../resources/icon/icon-list-active.svg'
}
/>
<span styleName='tooltip'>Notes</span>
</button>
)

ListButton.propTypes = {
onClick: PropTypes.func.isRequired,
isTagActive: PropTypes.bool.isRequired
}

export default CSSModules(ListButton, styles)
19 changes: 19 additions & 0 deletions browser/main/SideNav/PreferenceButton.js
@@ -0,0 +1,19 @@
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './PreferenceButton.styl'

const PreferenceButton = ({
onClick
}) => (
<button styleName='top-menu-preference' onClick={(e) => onClick(e)}>
<img styleName='iconTag' src='../resources/icon/icon-setting.svg' />
<span styleName='tooltip'>Preferences</span>
</button>
)

PreferenceButton.propTypes = {
onClick: PropTypes.func.isRequired
}

export default CSSModules(PreferenceButton, styles)