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

Update layout #698

Merged
merged 4 commits into from Jul 10, 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
2 changes: 1 addition & 1 deletion browser/main/Detail/InfoButton.js
Expand Up @@ -8,7 +8,7 @@ const InfoButton = ({
<button styleName='control-infoButton'
onClick={onClick}
>
<i className='fa fa-info-circle infoButton' styleName='info-button' />
<i className='fa fa-info infoButton' styleName='info-button' />
</button>
)

Expand Down
5 changes: 4 additions & 1 deletion browser/main/Detail/InfoButton.styl
Expand Up @@ -7,12 +7,15 @@
pointer-events none
top 50px
z-index 200
padding 5px
line-height normal
border-radius 2px
opacity 0
transition 0.1s

.infoButton
padding 0px
margin 15px 0

body[data-theme="dark"]
.control-infoButton
topBarButtonDark()
4 changes: 2 additions & 2 deletions browser/main/Detail/InfoPanel.js
Expand Up @@ -24,15 +24,15 @@ const InfoPanel = ({
</div>
<div styleName='group-section'>
<div styleName='group-section-label'>
CreatedAt
Created at
</div>
<div styleName='group-section-control'>
{createdAt}
</div>
</div>
<div styleName='group-section'>
<div styleName='group-section-label'>
UpdatedAt
Updated at
</div>
<div styleName='group-section-control'>
{updatedAt}
Expand Down
48 changes: 30 additions & 18 deletions browser/main/Detail/InfoPanel.styl
Expand Up @@ -3,42 +3,54 @@
pointer-events none
top 50px
z-index 200
padding 5px
line-height normal
border-radius 2px
border-radius 4px
opacity 0
transition 0.1s
transition 0.2s

.control-infoButton-panel
z-index 200
margin-top 60px
margin-left -160px
margin-top 45px
margin-left -210px
position absolute
padding 10px
padding-left 15px
width 300px
background-color #EAEAEA
border 1px solid #d0d0d0
box-shadow 0 0 1px rgba(76,86,103,0.15), 0 2px 18px rgba(31,37,50,0.22)
padding 20px
width 340px
background-color $ui-noteList-backgroundColor
border 1px solid $border-color

.group-section
display flex
line-height 30px
font-size 12px
font-size 13px

.group-section-label
width 70px
height 20px
text-align left
margin-right 30px
font-size 11px
color #939395
margin-right 50px
font-size 13px
color $ui-inactive-text-color

.group-section-control
flex 1
font-size 13px
color $ui-text-color

.group-section-control input
width 160px
height 25px

body[data-theme="dark"]
.control-infoButton-panel
background-color #3a404c
border 1px solid #474f5c
color #ffffff
background-color $ui-dark-noteList-backgroundColor
border 1px solid $ui-dark-borderColor

.group-section-label
color $ui-inactive-text-color

.group-section-control
color $ui-dark-text-color

.group-section-control input
background-color alpha($ui-dark-borderColor, 80%)
color $ui-dark-text-color
27 changes: 0 additions & 27 deletions browser/main/Detail/LastUpdatedString.js

This file was deleted.

10 changes: 0 additions & 10 deletions browser/main/Detail/LastUpdatedString.styl

This file was deleted.

2 changes: 1 addition & 1 deletion browser/main/Detail/MarkdownNoteDetail.styl
Expand Up @@ -29,7 +29,7 @@

.control-fullScreenButton
float right
padding 7px
padding 0 0 2px 0
topBarButtonLight()

.body
Expand Down
36 changes: 34 additions & 2 deletions browser/main/Detail/SnippetNoteDetail.js
Expand Up @@ -18,6 +18,9 @@ import _ from 'lodash'
import { findNoteTitle } from 'browser/lib/findNoteTitle'
import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig'
import TrashButton from './TrashButton'
import InfoButton from './InfoButton'
import InfoPanel from './InfoPanel'
import { formatDate } from 'browser/lib/date-formatter'

function pass (name) {
switch (name) {
Expand Down Expand Up @@ -54,7 +57,7 @@ class SnippetNoteDetail extends React.Component {
}

componentWillReceiveProps (nextProps) {
if (nextProps.note.key !== this.props.note.key) {
if (nextProps.note.key !== this.props.note.key && !this.isMovingNote) {
if (this.saveQueue != null) this.saveNow()
let nextNote = Object.assign({
description: ''
Expand Down Expand Up @@ -433,10 +436,18 @@ class SnippetNoteDetail extends React.Component {
this.refs['code-' + this.state.snippetIndex].focus()
}

handleInfoButtonClick (e) {
const infoPanel = document.querySelector('.infoPanel')
if (infoPanel.style) infoPanel.style.display = infoPanel.style.display === 'none' ? 'inline' : 'none'
}

render () {
let { data, config } = this.props
let { data, config, location } = this.props
let { note } = this.state

let storageKey = note.storage
let folderKey = note.folder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use const instead of let.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done💯


let editorFontSize = parseInt(config.editor.fontSize, 10)
if (!(editorFontSize > 0 && editorFontSize < 101)) editorFontSize = 14
let editorIndentSize = parseInt(config.editor.indentSize, 10)
Expand Down Expand Up @@ -491,6 +502,17 @@ class SnippetNoteDetail extends React.Component {
</div>
})

let options = []
data.storageMap.forEach((storage, index) => {
storage.folders.forEach((folder) => {
options.push({
storage: storage,
folder: folder
})
})
})
let currentOption = options.filter((option) => option.storage.key === storageKey && option.folder.key === folderKey)[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use const instead of let.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doen🎶


return (
<div className='NoteDetail'
style={this.props.style}
Expand Down Expand Up @@ -527,6 +549,16 @@ class SnippetNoteDetail extends React.Component {
>
<i className='fa fa-expand' styleName='fullScreen-button' />
</button>
<InfoButton
onClick={(e) => this.handleInfoButtonClick(e)}
/>
<InfoPanel
storageName={currentOption.storage.name}
folderName={currentOption.folder.name}
noteKey={location.query.key}
updatedAt={formatDate(note.updatedAt)}
createdAt={formatDate(note.createdAt)}
/>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion browser/main/Detail/SnippetNoteDetail.styl
Expand Up @@ -68,7 +68,7 @@

.control-fullScreenButton
float right
padding 7px
padding 0 0 2px 0
topBarButtonLight()

body[data-theme="dark"]
Expand Down
3 changes: 0 additions & 3 deletions browser/main/StatusBar/index.js
Expand Up @@ -2,7 +2,6 @@ import React, { PropTypes } from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './StatusBar.styl'
import ZoomManager from 'browser/main/lib/ZoomManager'
import LastUpdatedString from '../Detail/LastUpdatedString'

const electron = require('electron')
const { remote, ipcRenderer } = electron
Expand Down Expand Up @@ -68,8 +67,6 @@ class StatusBar extends React.Component {
</button>
: null
}

<LastUpdatedString date={this.props.date} />
</div>
)
}
Expand Down
5 changes: 2 additions & 3 deletions browser/styles/index.styl
Expand Up @@ -160,8 +160,7 @@ topBarButtonLight()
height 34px
border-radius 17px
font-size 14px
margin 13px 7px
padding-top 7px
margin 15px 7px
border none
color $ui-button-color
fill $ui-button-color
Expand All @@ -182,7 +181,7 @@ $ui-dark-noteDetail-backgroundColor = #2D3033
$ui-dark-tag-backgroundColor = #3A404C
$dark-background-color = lighten($ui-dark-backgroundColor, 10%)
$ui-dark-text-color = #DDDDDD
$ui-dark-button--active-color = white
$ui-dark-button--active-color = #f4f4f4
$ui-dark-button--active-backgroundColor = #3A404C
$ui-dark-button--hover-backgroundColor = lighten($ui-dark-backgroundColor, 10%)
$ui-dark-button--focus-borderColor = lighten(#369DCD, 25%)
Expand Down