-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
- Loading branch information
Showing
10 changed files
with
411 additions
and
404 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import TitleBar from './src/components/title-bar' | ||
import Navbar from './src/components/navbar' | ||
import Toolbar from './src/components/toolbar' | ||
import Alert from './src/components/alert' | ||
import Buttons from './src/components/button' | ||
import Dropdowns from './src/components/dropdown' | ||
import Switch from './src/components/switch' | ||
import View from './src/components/view' | ||
import Window from './src/components/window' | ||
import Stars from './src/components/stars' | ||
import TitleBar from './src/components/title-bar' | ||
import Navbar from './src/components/navbar' | ||
import Toolbar from './src/components/toolbar' | ||
import Alert from './src/components/alert' | ||
import Buttons from './src/components/button' | ||
import Dropdowns from './src/components/dropdown' | ||
import Switch from './src/components/switch' | ||
import View from './src/components/view' | ||
import Window from './src/components/window' | ||
import Stars from './src/components/stars' | ||
|
||
export { TitleBar, Navbar, Toolbar, Alert, Buttons, Dropdowns, Switch, View, Window, Stars } |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import React from 'react'; | ||
import { translate } from 'react-i18next'; | ||
import style from './style.styl'; | ||
import React from 'react' | ||
import { translate } from 'react-i18next' | ||
import style from './style.styl' | ||
|
||
const Alert = ({t, message}) => ( | ||
<div className={style['success']}> | ||
<span>{t(message)}</span> | ||
<i className="material-icons">check</i> | ||
</div> | ||
<div className={style['success']}> | ||
<span>{t(message)}</span> | ||
<i className='material-icons'>check</i> | ||
</div> | ||
) | ||
|
||
export default translate(['alert'])(Alert); | ||
export default translate(['alert'])(Alert) |
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 |
---|---|---|
@@ -1,64 +1,64 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { translate } from 'react-i18next'; | ||
import Toolbar from '../toolbar'; | ||
import style from './style.styl'; | ||
import React, { Component } from 'react' | ||
import PropTypes from 'prop-types' | ||
import { translate } from 'react-i18next' | ||
import Toolbar from '../toolbar' | ||
import style from './style.styl' | ||
|
||
const Identity = (a) => (a) | ||
|
||
const GoBackButton = ({action = Identity, title}) => ( | ||
<a className={style.backButton} onClick={action}> | ||
<i className="material-icons">arrow_back</i> | ||
{title ? <span>{title}</span> : null} | ||
</a> | ||
<a className={style.backButton} onClick={action}> | ||
<i className='material-icons'>arrow_back</i> | ||
{title ? <span>{title}</span> : null} | ||
</a> | ||
) | ||
|
||
GoBackButton.propTypes = { | ||
action: PropTypes.func.isRequired, | ||
action: PropTypes.func.isRequired | ||
} | ||
|
||
GoBackButton.defaultProps = { | ||
title: 'back' | ||
title: 'back' | ||
} | ||
|
||
const OneChildNavbar = ({children, type, show}) => ( | ||
<nav id="navbar" className={`${style.navbar} ${type ? type : ''}`} show={show?"true":"false"}> | ||
{children} | ||
</nav> | ||
<nav id='navbar' className={`${style.navbar} ${type || ''}`} show={show ? 'true' : 'false'}> | ||
{children} | ||
</nav> | ||
) | ||
|
||
const ComplexNavbar = ({goBack, title, right, children, left}) => [ | ||
<div className={style.menu} role='navbar-left' key='left'> | ||
{goBack && <GoBackButton {...goBack}/>} | ||
{left} | ||
{title && <h1 className={style.title}>{title}</h1>} | ||
</div>, | ||
children ? <div key='center' role='navbar-center'>{children}</div>: null, | ||
(children || right) ? <div key='right' role='navbar-right'>{right}</div> : null | ||
<div className={style.menu} role='navbar-left' key='left'> | ||
{goBack && <GoBackButton {...goBack} />} | ||
{left} | ||
{title && <h1 className={style.title}>{title}</h1>} | ||
</div>, | ||
children ? <div key='center' role='navbar-center'>{children}</div> : null, | ||
(children || right) ? <div key='right' role='navbar-right'>{right}</div> : null | ||
] | ||
|
||
const Navbar = ({goBack, title, right, children, left, type, show}) => { | ||
const complexProps = {goBack, title, right, children, left} | ||
const complexProps = {goBack, title, right, children, left} | ||
|
||
return ( | ||
<nav id="navbar" | ||
className={`${style.navbar} ${type ? type : ''}`} | ||
visible={show?"true":"false"}> | ||
{(goBack || title || right || left) ? | ||
<ComplexNavbar {...complexProps}/> | ||
: children} | ||
</nav> | ||
) | ||
return ( | ||
<nav id='navbar' | ||
className={`${style.navbar} ${type || ''}`} | ||
visible={show ? 'true' : 'false'}> | ||
{(goBack || title || right || left) | ||
? <ComplexNavbar {...complexProps} /> | ||
: children} | ||
</nav> | ||
) | ||
} | ||
|
||
Navbar.propTypes = { | ||
title: PropTypes.string, | ||
goBack: PropTypes.object | ||
title: PropTypes.string, | ||
goBack: PropTypes.object | ||
} | ||
|
||
const Translated = translate(['navbar'])(Navbar) | ||
|
||
export { | ||
Translated as default, | ||
GoBackButton, | ||
Translated as default, | ||
GoBackButton | ||
} |
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 |
---|---|---|
|
@@ -55,3 +55,5 @@ | |
font-weight: bold | ||
text-transform: uppercase | ||
|
||
|
||
|
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import React, { Component } from 'react'; | ||
import { translate } from 'react-i18next'; | ||
import style from './style.styl'; | ||
import React, { Component } from 'react' | ||
import { translate } from 'react-i18next' | ||
import style from './style.styl' | ||
|
||
const Search = ({action}) => ( | ||
<div id="search" className={style.search}> | ||
<input type="text" onChange={(e) => action(e.target.value)} | ||
className={style.input} placeholder="Search..."/> | ||
<i className="material-icons">search</i> | ||
</div> | ||
<div id='search' className={style.search}> | ||
<input type='text' onChange={(e) => action(e.target.value)} | ||
className={style.input} placeholder='Search...' /> | ||
<i className='material-icons'>search</i> | ||
</div> | ||
) | ||
|
||
export default translate(['search'])(Search); | ||
export default translate(['search'])(Search) |
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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { translate } from 'react-i18next'; | ||
import style from './style.styl'; | ||
import React, { Component } from 'react' | ||
import PropTypes from 'prop-types' | ||
import { translate } from 'react-i18next' | ||
import style from './style.styl' | ||
|
||
const View = ({children}) => ( | ||
<div className={style.view} ref={node => node && node.addEventListener('scroll', e => console.log('scroll outter', e))}> | ||
<div className={style.content} ref={node => node && node.addEventListener('scroll', e => console.log('scroll inner', e))}> | ||
{children} | ||
</div> | ||
<div className={style.view} ref={node => node && node.addEventListener('scroll', e => console.log('scroll outter', e))}> | ||
<div className={style.content} ref={node => node && node.addEventListener('scroll', e => console.log('scroll inner', e))}> | ||
{children} | ||
</div> | ||
</div> | ||
) | ||
|
||
View.propTypes = { | ||
navbar: PropTypes.object | ||
navbar: PropTypes.object | ||
} | ||
|
||
export {View as default} |
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 |
---|---|---|
@@ -1,94 +1,94 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { translate } from 'react-i18next'; | ||
import View from '../view'; | ||
import TitleBar from '../title-bar'; | ||
import Navbar from '../navbar'; | ||
import style from './style.styl'; | ||
import React, { Component } from 'react' | ||
import PropTypes from 'prop-types' | ||
import { translate } from 'react-i18next' | ||
import View from '../view' | ||
import TitleBar from '../title-bar' | ||
import Navbar from '../navbar' | ||
import style from './style.styl' | ||
|
||
class Window extends React.Component { | ||
constructor (props) { | ||
super(props); | ||
constructor (props) { | ||
super(props) | ||
|
||
this.state = { | ||
fullscreen: props.fullscreen | ||
} | ||
this.state = { | ||
fullscreen: props.fullscreen | ||
} | ||
} | ||
|
||
setFullscreen () { | ||
this.setState(prevState => { | ||
const {actions} = this.props | ||
const fullscreen = !!!prevState.fullscreen | ||
actions.fullscreen(fullscreen) | ||
return {fullscreen} | ||
}) | ||
} | ||
|
||
render () { | ||
const {title, titlebar, bars, ...props} = this.props | ||
const {fullscreen} = this.state | ||
setFullscreen () { | ||
this.setState(prevState => { | ||
const {actions} = this.props | ||
const fullscreen = !prevState.fullscreen | ||
actions.fullscreen(fullscreen) | ||
return {fullscreen} | ||
}) | ||
} | ||
|
||
const actions = { | ||
...this.props.actions, | ||
fullscreen: this.setFullscreen.bind(this) | ||
} | ||
render () { | ||
const {title, titlebar, bars, ...props} = this.props | ||
const {fullscreen} = this.state | ||
|
||
return ( | ||
<div className={style.windowOuter}> | ||
<TitleBar title={title} actions={actions} fullscreen={fullscreen} {...titlebar}/> | ||
{bars} | ||
<div className={style.windowInner} style={{ | ||
height: fullscreen ? '100%' : 'calc(100% - var(--Window-handler-height))' | ||
}}> | ||
<View> | ||
{props.children} | ||
</View> | ||
</div> | ||
</div> | ||
) | ||
const actions = { | ||
...this.props.actions, | ||
fullscreen: this.setFullscreen.bind(this) | ||
} | ||
|
||
return ( | ||
<div className={style.windowOuter}> | ||
<TitleBar title={title} actions={actions} fullscreen={fullscreen} {...titlebar} /> | ||
{bars} | ||
<div className={style.windowInner} style={{ | ||
height: fullscreen ? '100%' : 'calc(100% - var(--Window-handler-height))' | ||
}}> | ||
<View> | ||
{props.children} | ||
</View> | ||
</div> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
Window.defaultProps = { | ||
fullscreen: false | ||
fullscreen: false | ||
} | ||
|
||
Window.propTypes = { | ||
fullscreen: PropTypes.bool | ||
fullscreen: PropTypes.bool | ||
} | ||
|
||
const DemoWindow = ({opacity = 0.5, ...props}) => ( | ||
<div className={style.demoWindow} style={{ | ||
backgroundColor: `rgba(var(--Window-bg), ${opacity})`, | ||
marginBottom: '150px' | ||
}}> | ||
<Window {...props} /> | ||
</div> | ||
<div className={style.demoWindow} style={{ | ||
backgroundColor: `rgba(var(--Window-bg), ${opacity})`, | ||
marginBottom: '150px' | ||
}}> | ||
<Window {...props} /> | ||
</div> | ||
) | ||
|
||
Window.defaultProps = { | ||
titlebar: { | ||
platform: 'darwin', | ||
}, | ||
actions: { | ||
close: () => console.log("Close window..."), | ||
max: () => console.log("Maximize window..."), | ||
min: () => console.log("Minimize window..."), | ||
fullscreen: (active) => { | ||
console.log(`${active ? "Enter" : "Exit"} Fullscreen...`) | ||
} | ||
}, | ||
navbar: { | ||
toolbar: { | ||
search: false, | ||
buttons: [ | ||
{title: "button-01", icon:"shuffle"}, | ||
{title: "button-02", icon:"visibility", toogle: true}, | ||
{title: "button-03", icon:"favorite", active: true, update: true, toogle: true}, | ||
{title: "button-04", icon:"settings"} | ||
] | ||
} | ||
titlebar: { | ||
platform: 'darwin' | ||
}, | ||
actions: { | ||
close: () => console.log('Close window...'), | ||
max: () => console.log('Maximize window...'), | ||
min: () => console.log('Minimize window...'), | ||
fullscreen: (active) => { | ||
console.log(`${active ? 'Enter' : 'Exit'} Fullscreen...`) | ||
} | ||
}, | ||
navbar: { | ||
toolbar: { | ||
search: false, | ||
buttons: [ | ||
{title: 'button-01', icon: 'shuffle'}, | ||
{title: 'button-02', icon: 'visibility', toogle: true}, | ||
{title: 'button-03', icon: 'favorite', active: true, update: true, toogle: true}, | ||
{title: 'button-04', icon: 'settings'} | ||
] | ||
} | ||
} | ||
} | ||
|
||
export {Window as default, DemoWindow} |
Oops, something went wrong.