1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 02:06:29 +00:00

added button for copy note link

This commit is contained in:
Maurits Lourens
2018-01-15 21:01:18 +01:00
parent 94be3d1fe5
commit 657489caf6
2 changed files with 100 additions and 72 deletions

View File

@@ -2,10 +2,20 @@ import PropTypes from 'prop-types'
import React from 'react' import React from 'react'
import CSSModules from 'browser/lib/CSSModules' import CSSModules from 'browser/lib/CSSModules'
import styles from './InfoPanel.styl' import styles from './InfoPanel.styl'
import copy from 'copy-to-clipboard'
const InfoPanel = ({ class InfoPanel extends React.Component {
copyNoteLink () {
const {noteLink} = this.props
this.refs.noteLink.select()
copy(noteLink)
}
render () {
const {
storageName, folderName, noteLink, updatedAt, createdAt, exportAsMd, exportAsTxt, exportAsHtml, wordCount, letterCount, type, print storageName, folderName, noteLink, updatedAt, createdAt, exportAsMd, exportAsTxt, exportAsHtml, wordCount, letterCount, type, print
}) => ( } = this.props
return (
<div className='infoPanel' styleName='control-infoButton-panel' style={{display: 'none'}}> <div className='infoPanel' styleName='control-infoButton-panel' style={{display: 'none'}}>
<div> <div>
<p styleName='modification-date'>{updatedAt}</p> <p styleName='modification-date'>{updatedAt}</p>
@@ -49,7 +59,10 @@ const InfoPanel = ({
</div> </div>
<div> <div>
<input styleName='infoPanel-noteLink' value={noteLink} onClick={(e) => { e.target.select() }} /> <input styleName='infoPanel-noteLink' ref='noteLink' value={noteLink} onClick={(e) => { e.target.select() }} />
<button onClick={() => this.copyNoteLink()} styleName='infoPanel-copyButton'>
<i className='fa fa-clipboard' />
</button>
<p styleName='infoPanel-sub'>NOTE LINK</p> <p styleName='infoPanel-sub'>NOTE LINK</p>
</div> </div>
@@ -77,7 +90,9 @@ const InfoPanel = ({
</button> </button>
</div> </div>
</div> </div>
) )
}
}
InfoPanel.propTypes = { InfoPanel.propTypes = {
storageName: PropTypes.string.isRequired, storageName: PropTypes.string.isRequired,

View File

@@ -15,7 +15,6 @@
position absolute position absolute
padding 20px 25px 0 25px padding 20px 25px 0 25px
width 300px width 300px
height 350px
overflow auto overflow auto
background-color $ui-noteList-backgroundColor background-color $ui-noteList-backgroundColor
box-shadow 2px 12px 15px 2px rgba(0, 0, 0, 0.1), 2px 1px 50px 2px rgba(0, 0, 0, 0.1) box-shadow 2px 12px 15px 2px rgba(0, 0, 0, 0.1), 2px 1px 50px 2px rgba(0, 0, 0, 0.1)
@@ -80,6 +79,20 @@
height 25px height 25px
margin-bottom 6px margin-bottom 6px
.infoPanel-copyButton
outline none
font-size 16px
color #A0A0A0
background-color transparent
border none
margin 0 5px
border-radius 5px
cursor pointer
&:hover
transition 0.2s
background-color alpha($ui-button--hover-backgroundColor, 30%)
color $ui-inactive-text-color
.infoPanel-trash .infoPanel-trash
color #EA4447 color #EA4447
font-weight 600 font-weight 600