diff --git a/index.js b/index.js index 93f9d48..fb01b2a 100644 --- a/index.js +++ b/index.js @@ -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 } diff --git a/src/components/alert/index.js b/src/components/alert/index.js index 9f7f7ab..80955e7 100644 --- a/src/components/alert/index.js +++ b/src/components/alert/index.js @@ -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}) => ( -
- {t(message)} - check -
+
+ {t(message)} + check +
) -export default translate(['alert'])(Alert); +export default translate(['alert'])(Alert) diff --git a/src/components/navbar/index.js b/src/components/navbar/index.js index 69c0fe4..be0895f 100644 --- a/src/components/navbar/index.js +++ b/src/components/navbar/index.js @@ -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}) => ( - - arrow_back - {title ? {title} : null} - + + arrow_back + {title ? {title} : null} + ) GoBackButton.propTypes = { - action: PropTypes.func.isRequired, + action: PropTypes.func.isRequired } GoBackButton.defaultProps = { - title: 'back' + title: 'back' } const OneChildNavbar = ({children, type, show}) => ( - + ) const ComplexNavbar = ({goBack, title, right, children, left}) => [ -
- {goBack && } - {left} - {title &&

{title}

} -
, - children ?
{children}
: null, - (children || right) ?
{right}
: null +
+ {goBack && } + {left} + {title &&

{title}

} +
, + children ?
{children}
: null, + (children || right) ?
{right}
: 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 ( - - ) + return ( + + ) } 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 } diff --git a/src/components/navbar/style.styl b/src/components/navbar/style.styl index 696ceac..2807216 100644 --- a/src/components/navbar/style.styl +++ b/src/components/navbar/style.styl @@ -55,3 +55,5 @@ font-weight: bold text-transform: uppercase + + diff --git a/src/components/search/index.js b/src/components/search/index.js index b9bf9cd..9684281 100644 --- a/src/components/search/index.js +++ b/src/components/search/index.js @@ -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}) => ( - + ) -export default translate(['search'])(Search); +export default translate(['search'])(Search) diff --git a/src/components/view/index.js b/src/components/view/index.js index 4726fef..6ecef67 100644 --- a/src/components/view/index.js +++ b/src/components/view/index.js @@ -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}) => ( -
node && node.addEventListener('scroll', e => console.log('scroll outter', e))}> -
node && node.addEventListener('scroll', e => console.log('scroll inner', e))}> - {children} -
+
node && node.addEventListener('scroll', e => console.log('scroll outter', e))}> +
node && node.addEventListener('scroll', e => console.log('scroll inner', e))}> + {children}
+
) View.propTypes = { - navbar: PropTypes.object + navbar: PropTypes.object } export {View as default} diff --git a/src/components/window/index.js b/src/components/window/index.js index ae7fc28..955b7a5 100644 --- a/src/components/window/index.js +++ b/src/components/window/index.js @@ -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 ( -
- - {bars} -
- - {props.children} - -
-
- ) + const actions = { + ...this.props.actions, + fullscreen: this.setFullscreen.bind(this) } + + return ( +
+ + {bars} +
+ + {props.children} + +
+
+ ) + } } Window.defaultProps = { - fullscreen: false + fullscreen: false } Window.propTypes = { - fullscreen: PropTypes.bool + fullscreen: PropTypes.bool } const DemoWindow = ({opacity = 0.5, ...props}) => ( -
- -
+
+ +
) 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} diff --git a/src/index.js b/src/index.js index e5b8df1..aff746b 100644 --- a/src/index.js +++ b/src/index.js @@ -1,63 +1,68 @@ -import React from 'react'; -import {translate} from 'react-i18next'; -import TitleBar from './components/title-bar'; -import Navbar from './components/navbar'; -import Toolbar from './components/toolbar'; -import Buttons from './components/button'; -import Dropdowns from './components/dropdown'; -import Switch from './components/switch'; -import Stars from './components/stars'; -import View from './components/view'; -import Window, {DemoWindow} from './components/window'; - -import Menu from 'butter-component-menu'; - -import style from './style.styl'; +import React from 'react' +import {translate} from 'react-i18next' +import TitleBar from './components/title-bar' +import Navbar, {GoBackButton, OneChildNavbar} from './components/navbar' +import Toolbar from './components/toolbar' +import Buttons from './components/button' +import Dropdowns from './components/dropdown' +import Switch from './components/switch' +import Stars from './components/stars' +import View from './components/view' +import Window, {DemoWindow} from './components/window' +import Menu from 'butter-component-menu' +import Spinner from './components/spinner/' + +import style from './style.styl' let Test = ({view, title, t, ...props}) => ( -
- } right={}/> - ]}> +
+ } right={} /> + ]}> -
- {props.buttons.map((i, k) => )} -
+
+ {props.buttons.map((i, k) => )} +
-
- {props.dropdowns.text.map((i, k) => )} -
+
+ {props.dropdowns.text.map((i, k) => )} +
-
- {props.dropdowns.color.map((i, k) => )} -
+
+ {props.dropdowns.color.map((i, k) => )} +
-
- {props.switches.map((i, k) => )} -
+
+ {props.switches.map((i, k) => )} +
-
+ }}>

stars

- {props.stars.map((i, k) => )} -
-
- { - props.titleBar.map((i, k) => -
- -
- ) - } - - { - props.navbars.map(({toolbar, ...props}, k) => -
- } {...props}/> -
- ) - } -
) + {props.stars.map((i, k) => )} +
+ +
+

spinner

+ +
+ + { + props.titleBar.map((i, k) => +
+ +
+ ) + } + + { + props.navbars.map(({toolbar, ...props}, k) => +
+ } {...props} /> +
+ ) + } +
) export default translate('test')(Test) diff --git a/test/data.js b/test/data.js index 15157f2..18d0f2b 100644 --- a/test/data.js +++ b/test/data.js @@ -1,223 +1,223 @@ export default { - menu: { - items: [ - {title: 'movies'}, - {title: 'shows'}, - {title: 'anime'}, - {title: 'independent'}, - ] + menu: { + items: [ + {title: 'movies'}, + {title: 'shows'}, + {title: 'anime'}, + {title: 'independent'} + ] + }, + view: { + 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...`) + } + } + }, + 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...`) + } + } }, - view: { - 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...`) - } - } - }, - 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"} - ] + { + title: 'Linux-style', + platform: 'linux', + actions: { + close: () => console.log('Close window...'), + max: () => console.log('Maximize window...'), + min: () => console.log('Minimize window...'), + fullscreen: (active) => { + console.log(`${active ? 'Enter' : 'Exit'} Fullscreen...`) } + } + }, + { + title: 'source_file.mp4', + platform: 'win32', + actions: { + close: () => console.log('Close window...'), + max: () => console.log('Maximize window...'), + min: () => console.log('Minimize window...'), + fullscreen: (active) => { + console.log(`${active ? 'Enter' : 'Exit'} Fullscreen...`) + } + } + } + ], + buttons: [ + { + type: 'normal', + title: 'Normal button', + action: () => {} + }, + { + type: 'secondary', + title: 'Secondary button', + action: () => {} + }, + { + type: 'secondary', + title: 'Icon', + icon: 'touch_app', + action: () => {} + }, + { + type: 'minimal', + title: 'Minimalist', + action: () => {} + } + ], + dropdowns: { + text: [{ + options: [ + '0', + '1', + '2', + '3' + ] }, - titleBar: [ + { + options: [ + 'Item 1', + 'Item 2', + 'Item 3', + 'Item 4' + ] + }, + { + options: [ + 'Ant', + 'Bird', + 'Cat', + 'Dog', + 'Elephant', + 'Fox', + 'Giraffe', + 'Hawk', + 'Iguana', + 'Jaguar', + 'Koala', + 'Lion', + 'Makaw', + 'Nyala', + 'Owl', + 'Penguin', + 'Quail', + 'Rabbit', + 'Snake', + 'Turtule', + 'Urial', + 'Viper', + 'Wolf', + 'Yak', + 'Zebra' + ] + }], + color: [ { - 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...`) - } - } + options: [ + '#555', + '#777', + '#999', + '#BBB', + '#DDD', + '#FFF' + ] }, { - title: 'Linux-style', - platform: 'linux', - actions: { - close: () => console.log("Close window..."), - max: () => console.log("Maximize window..."), - min: () => console.log("Minimize window..."), - fullscreen: (active) => { - console.log(`${active ? "Enter" : "Exit"} Fullscreen...`) - } - } + options: [ + '#2d72d9', + '#0b6fcb', + '#1689f3', + '#46a1f5', + '#76baf8', + '#a7d2fa' + ] }, { - title: 'source_file.mp4', - platform: 'win32', - actions: { - close: () => console.log("Close window..."), - max: () => console.log("Maximize window..."), - min: () => console.log("Minimize window..."), - fullscreen: (active) => { - console.log(`${active ? "Enter" : "Exit"} Fullscreen...`) - } - } + options: [ + '#ff0033', + '#9933ff', + '#0066ff', + '#00cc33', + '#ffcc00', + '#ff9933' + ] } - ], - buttons: [ - { - type:"normal", - title:"Normal button", - action: () => {} - }, - { - type:"secondary", - title:"Secondary button", - action: () => {} - }, - { - type:"secondary", - title:"Icon", - icon: "touch_app", - action: () => {} - }, - { - type:"minimal", - title:"Minimalist", - action: () => {} - }, - ], - dropdowns: { - text: [{ - options: [ - "0", - "1", - "2", - "3" - ] - }, - { - options: [ - "Item 1", - "Item 2", - "Item 3", - "Item 4" - ] - }, - { - options: [ - "Ant", - "Bird", - "Cat", - "Dog", - "Elephant", - "Fox", - "Giraffe", - "Hawk", - "Iguana", - "Jaguar", - "Koala", - "Lion", - "Makaw", - "Nyala", - "Owl", - "Penguin", - "Quail", - "Rabbit", - "Snake", - "Turtule", - "Urial", - "Viper", - "Wolf", - "Yak", - "Zebra" - ] - }], - color: [ - { - options: [ - "#555", - "#777", - "#999", - "#BBB", - "#DDD", - "#FFF" - ] - }, - { - options: [ - "#2d72d9", - "#0b6fcb", - "#1689f3", - "#46a1f5", - "#76baf8", - "#a7d2fa" - ] - }, - { - options: [ - "#ff0033", - "#9933ff", - "#0066ff", - "#00cc33", - "#ffcc00", - "#ff9933", - ] - } + ] + }, + navbars: [ + { + toolbar: { + search: true, + 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'} ] + } }, - navbars: [ - { - toolbar: { - search: true, - 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"} - ] - } - }, - { - title: "Settings", - goBack: () => {}, - toolbar: { - search: false, - buttons: [ - {title: "button-01", icon:"keyboard"}, - {title: "button-02", icon:"info_outline"}, - {title: "button-03", icon:"update", update: true}, - {title: "button-04", icon:"filter_list", active: true, toogle: true} - ] - } - }, - { - title: "Fight Club (1999)", - goBack: () => {}, - toolbar: { - search: false, - buttons: [ - {title: "button-01", icon:"fiber_manual_record"}, - {title: "button-02", icon:"link"}, - {title: "button-03", icon:"favorite_outline"}, - {title: "button-04", icon:"visibility"} - ] - } - } - ], - switches: [ - { selected: true }, - { selected: false }, - { selected: true }, - { selected: false }, - { selected: true } - ], - stars: [ - { rating: 2}, - { rating: 10}, - { rating: 7, count: 2}, - { rating: 7, count: 14} - ] + { + title: 'Settings', + goBack: () => {}, + toolbar: { + search: false, + buttons: [ + {title: 'button-01', icon: 'keyboard'}, + {title: 'button-02', icon: 'info_outline'}, + {title: 'button-03', icon: 'update', update: true}, + {title: 'button-04', icon: 'filter_list', active: true, toogle: true} + ] + } + }, + { + title: 'Fight Club (1999)', + goBack: () => {}, + toolbar: { + search: false, + buttons: [ + {title: 'button-01', icon: 'fiber_manual_record'}, + {title: 'button-02', icon: 'link'}, + {title: 'button-03', icon: 'favorite_outline'}, + {title: 'button-04', icon: 'visibility'} + ] + } + } + ], + switches: [ + { selected: true }, + { selected: false }, + { selected: true }, + { selected: false }, + { selected: true } + ], + stars: [ + { rating: 2}, + { rating: 10}, + { rating: 7, count: 2}, + { rating: 7, count: 14} + ] } diff --git a/test/travis.js b/test/travis.js index 546dd3d..0978e7f 100644 --- a/test/travis.js +++ b/test/travis.js @@ -1 +1 @@ -console.log("Test..."); +console.log('Test...')