-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(room-toolbar): Add toolbar for room (#7)
- Loading branch information
1 parent
155675a
commit 4586cdd
Showing
12 changed files
with
220 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React, { Component } from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
class Soundcheck extends Component { | ||
render () { | ||
return <span>Hello Soundcheck</span> | ||
} | ||
} | ||
|
||
Soundcheck.propTypes = { | ||
|
||
} | ||
|
||
export default Soundcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
import React, { Component } from 'react' | ||
import PropTypes from 'prop-types' | ||
import { Modal } from 'semantic-ui-react' | ||
import Soundcheck from './index' | ||
|
||
class SoundcheckWrapper extends Component { | ||
render () { | ||
return ( | ||
<Modal | ||
open={this.props.show} | ||
closeOnDimmerClick | ||
closeOnDocumentClick | ||
onClose={this.props.onClose} | ||
> | ||
<Modal.Header>Soundcheck</Modal.Header> | ||
<Modal.Content> | ||
<Soundcheck /> | ||
</Modal.Content> | ||
</Modal> | ||
) | ||
} | ||
} | ||
|
||
SoundcheckWrapper.propTypes = { | ||
onClose: PropTypes.func, | ||
show: PropTypes.bool | ||
} | ||
|
||
export default SoundcheckWrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { Component } from 'react' | ||
import { Icon, Menu } from 'semantic-ui-react' | ||
import PropTypes from 'prop-types' | ||
import { map } from 'lodash' | ||
|
||
class Toolbar extends Component { | ||
renderMenuItem = (item) => ( | ||
<Menu.Item | ||
key={item.key} | ||
name={item.name || item.key} | ||
active={this.props.activeMenuItem === item.key} | ||
onClick={item.onClick} | ||
> | ||
<Icon name={item.icon} /> | ||
{item.label || item.key} | ||
</Menu.Item> | ||
) | ||
render() { | ||
return ( | ||
<Menu compact icon='labeled'> | ||
{map(this.props.items, item => this.renderMenuItem(item))} | ||
</Menu> | ||
) | ||
} | ||
} | ||
|
||
Toolbar.propTypes = { | ||
items: PropTypes.arrayOf(PropTypes.object), | ||
activeMenuItem: PropTypes.string | ||
} | ||
|
||
Toolbar.defaultProps = { | ||
activeMenuItem: null | ||
} | ||
|
||
export default Toolbar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React, { Component } from 'react' | ||
import PropTypes from 'prop-types' | ||
import Toolbar from './index' | ||
import SoundcheckWrapper from '../soundcheck/soundcheck-wrapper' | ||
|
||
class ToolbarWrapper extends Component { | ||
constructor (props) { | ||
super(props) | ||
this.onExitRoom = this.onExitRoom.bind(this) | ||
this.onSettingsClick = this.onSettingsClick.bind(this) | ||
this.state = { | ||
showSettingsModal: false | ||
} | ||
} | ||
|
||
toggleSettingsModalState = () => this.setState({ | ||
showSettingsModal: !this.state.showSettingsModal | ||
}) | ||
|
||
onSettingsClick () { | ||
this.toggleSettingsModalState() | ||
} | ||
|
||
onExitRoom () { | ||
this.props.onLeaveRoom() | ||
// @todo: Move to router history | ||
window.location.replace('/') | ||
} | ||
|
||
render () { | ||
const menuItems = [{ | ||
key: 'setting', | ||
label: 'Settings', | ||
icon: 'setting', | ||
onClick: this.onSettingsClick | ||
}, { | ||
key: 'exit', | ||
label: 'Exit Room', | ||
icon: 'external', | ||
onClick: this.onExitRoom | ||
}] | ||
return ( | ||
<div> | ||
<Toolbar | ||
items={menuItems} | ||
/> | ||
<SoundcheckWrapper | ||
show={this.state.showSettingsModal} | ||
onClose={this.toggleSettingsModalState} | ||
/> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
ToolbarWrapper.propTypes = { | ||
onLeaveRoom: PropTypes.func, | ||
history: PropTypes.any | ||
} | ||
|
||
export default ToolbarWrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters