diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-03-11 14:38:02 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-03-11 14:38:02 +0100 |
| commit | 37896f6960f8145a13e2943fbb0cde52da430d30 (patch) | |
| tree | 40cb7ca2a6b470dc397dd0ba99998ad899a212b0 /animism-align/frontend/app/views/editor/sidebar/sidebar.container.js | |
| parent | 64cd37eae81845dc5eaace17739a72299cfc6c67 (diff) | |
move sidebar and timeline out of align folder
Diffstat (limited to 'animism-align/frontend/app/views/editor/sidebar/sidebar.container.js')
| -rw-r--r-- | animism-align/frontend/app/views/editor/sidebar/sidebar.container.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/animism-align/frontend/app/views/editor/sidebar/sidebar.container.js b/animism-align/frontend/app/views/editor/sidebar/sidebar.container.js new file mode 100644 index 0000000..350505b --- /dev/null +++ b/animism-align/frontend/app/views/editor/sidebar/sidebar.container.js @@ -0,0 +1,44 @@ +import React, { Component } from 'react' +import { connect } from 'react-redux' +// import { Link } from 'react-router-dom' + +import './sidebar.css' + +import actions from 'app/actions' + +import Script from './components/script.component.js' +import TableOfContents from './components/tableOfContents.component.js' +import WaveUpload from './components/waveUpload.component.js' + +class Sidebar extends Component { + state = { + mode: "toc", + } + componentDidMount(){ + if (!this.props.peaks.length) { + this.setState({ mode: "wav" }) + } + } + + render() { + const { mode } = this.state + return ( + <div className='sidebar'> + <div className='buttons'> + <button className={mode === "txt" ? "active" : ""} onClick={() => this.setState({ mode: "txt" })}>text</button> + <button className={mode === "wav" ? "active" : ""} onClick={() => this.setState({ mode: "wav" })}>wav</button> + <button className={mode === "toc" ? "active" : ""} onClick={() => this.setState({ mode: "toc" })}>contents</button> + </div> + {mode === 'toc' && <TableOfContents />} + {mode === 'txt' && <Script />} + {mode === 'wav' && <WaveUpload />} + </div> + ) + } +} + +const mapStateToProps = state => ({ + peaks: state.align.peaks, +}) + +export default connect(mapStateToProps)(Sidebar) |
