Skip to content

Commit

Permalink
Add menubar.
Browse files Browse the repository at this point in the history
  • Loading branch information
davymitchell committed Mar 5, 2019
1 parent 11102f7 commit 54968f6
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react'

import Editor from './components/Editor/Editor'
import TabBar from './components/TabBar/TabBar'
import MenuBar from './components/MenuBar/MenuBar'
import StatusPanel from './components/StatusPanel/StatusPanel'
import ThemeManager from './lib/ThemeManager'
import AppManager from './model/AppManager'
Expand All @@ -27,6 +28,7 @@ class App extends Component {
render() {
return (
<div className="App" style={theme.getColorStyles()}>
<MenuBar/>
<TabBar />
<Editor />
<StatusPanel />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Editor/Editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.Editor {
text-align: left;
width: calc(100% - 10px);
height: calc(100vh - 70px);
height: calc(100vh - 110px);
overflow-y: auto;
resize: none;
outline: none;
Expand Down
13 changes: 13 additions & 0 deletions src/components/MenuBar/MenuBar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.MenuBarContainer {
display: flex;
flex-direction: row-reverse;
border-bottom: solid 1px #606993;
height: 30px;
}

button {
border-radius: 5px;
margin-right: 5px;
font-weight: bolder;
margin: 2px;
}
33 changes: 33 additions & 0 deletions src/components/MenuBar/MenuBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React, { Component } from 'react'

import ThemeManager from '../../lib/ThemeManager'
import DocumentManager from '../../model/DocumentManager'

import './MenuBar.css'

const theme = ThemeManager.getInstance()
const documents = DocumentManager.getInstance()

class MenuBar extends Component {
render() {
return (
<div className="MenuBarContainer">
<button style={theme.getColorStyles()} onClick={this.download}>
Download
</button>
</div>
)
}

download() {
let element = document.createElement('a')
element.setAttribute(
'href',
'data:text/text;charset=utf-8,' + encodeURI(documents.activeNote.text)
)
element.setAttribute('download', documents.activeNote.downloadName)
element.click()
}
}

export default MenuBar
13 changes: 0 additions & 13 deletions src/components/TabBar/TabBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ class TabBar extends Component {
<button style={theme.getColorStyles()} onClick={this.next}>
&gt;
</button>
&nbsp;&nbsp;&nbsp;&nbsp;
<button style={theme.getColorStyles()} onClick={this.download}>
Download
</button>
</div>
</div>
)
Expand All @@ -45,15 +41,6 @@ class TabBar extends Component {
documents.moveToNextTab()
}

download() {
let element = document.createElement('a')
element.setAttribute(
'href',
'data:text/text;charset=utf-8,' + encodeURI(documents.activeNote.text)
)
element.setAttribute('download', documents.activeNote.downloadName)
element.click()
}
}

export default TabBar

0 comments on commit 54968f6

Please sign in to comment.