diff --git a/src/common/Checkbox/Checkbox.js b/src/common/Checkbox/Checkbox.js index 707c30d6c..0a64306ed 100644 --- a/src/common/Checkbox/Checkbox.js +++ b/src/common/Checkbox/Checkbox.js @@ -1,5 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; +import classnames from 'classnames'; +import Icon from 'stremio-icons/dom'; import styles from './styles'; class Checkbox extends Component { @@ -8,26 +10,33 @@ class Checkbox extends Component { nextProps.enabled !== this.props.enabled; } - onPress = () => { - if (this.props.enabled && typeof this.props.onPress === 'function') { - this.props.onPress(); + onClick = () => { + if (this.props.enabled && typeof this.props.onClick === 'function') { + this.props.onClick(); } } render() { return ( -
+
+ +
); } } Checkbox.propTypes = { + iconHeight: PropTypes.number, + iconWidth: PropTypes.number, + className: PropTypes.string, enabled: PropTypes.bool.isRequired, checked: PropTypes.bool.isRequired, - onPress: PropTypes.func + onClick: PropTypes.func }; + Checkbox.defaultProps = { - enabled: true + enabled: true, + checked: false }; export default Checkbox; diff --git a/src/common/Checkbox/styles.less b/src/common/Checkbox/styles.less index df379745a..3f968dda2 100644 --- a/src/common/Checkbox/styles.less +++ b/src/common/Checkbox/styles.less @@ -1,6 +1,26 @@ @import 'stremio-colors'; + .root { - width: 30px; - height: 30px; - background-color: @colorprimlight60; + margin: 30px; + display: flex; + cursor: pointer; + + &.checkbox-checked { + border: 2px solid @colorprimlight; + background-color: @colorprimlight; + } + + &.checkbox-disabled { + opacity: 0.5; + cursor: not-allowed; + } + + .icon { + margin: auto; + fill: @colorwhite60; + + &.checked { + fill: @colorwhite; + } + } } \ No newline at end of file diff --git a/src/routes/Settings/Settings.js b/src/routes/Settings/Settings.js index 9f50fd060..e27c7a7f3 100644 --- a/src/routes/Settings/Settings.js +++ b/src/routes/Settings/Settings.js @@ -1,7 +1,6 @@ import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import Icon from 'stremio-icons/dom'; import classnames from 'classnames'; +import Icon from 'stremio-icons/dom'; import styles from './styles'; const SETTINGS_MENUS = { @@ -26,42 +25,42 @@ class Settings extends Component { } shouldComponentUpdate(nextState) { - return nextState.selectedMenu != this.state.selectedMenu; + return nextState.selectedMenu !== this.state.selectedMenu; } renderPlayerSettings = () => { const preferences = ['Hardware-accelerated decoding', 'Auto-play next episode', 'Data saver']; return ( -
- {preferences.map((item, key) => - - )} +
+
+ {preferences.map((preference) => + + )} +
); } renderLanguageSettings = () => { return ( -
-
- INTERFACE LANGUAGE -
English - -
-
-
- DEFAULT SUBTITLES LANGUAGE -
Portugese - BR - -
-
+
+ +
); } @@ -79,15 +78,15 @@ class Settings extends Component { render() { return ( -
+
{Object.keys(SETTINGS_MENUS).map((menu) => -
this.changeSelectedMenu(SETTINGS_MENUS[menu])}>{menu}
+
this.changeSelectedMenu(SETTINGS_MENUS[menu])}>{menu}
)}
{this.renderSelectedMenu()}
- ) + ); } } diff --git a/src/routes/Settings/styles.less b/src/routes/Settings/styles.less index 297e51b55..7caab927f 100644 --- a/src/routes/Settings/styles.less +++ b/src/routes/Settings/styles.less @@ -1,103 +1,98 @@ @import 'stremio-colors'; -.settings { + +.settings-container { height: 100%; + width: 100%; display: flex; color: @colorwhite60; font-family: LatoLight; + .side-menu { width: 240px; padding: 20px; display: flex; - font-size: 14px; flex-direction: column; + font-size: 14px; background: @colordarkest; + .menu-option { padding: 14px; font-weight: 600; - &:hover { - cursor: pointer; - color: @colorwhite; - background: @colorglass; - } - &.menu-option-selected { + + &:hover, &.selected { cursor: pointer; color: @colorwhite; background: @colorglass; } } } - .player-preferences-menu { - height: 145px; + + .settings-list { + width: 280px; margin: 40px 50px; - border-bottom: 1px solid @colormedium; - .preferences-section { + + .settings-section { display: flex; - cursor: pointer; - margin-bottom: 30px; - align-items: center; - .preference { - width: 280px; - } - .default-checkbox { - display: none; - } - .checkbox { - width: 14px; - height: 14px; - cursor: pointer; - border: 2px solid @colorwhite60; - .checkmark { - width: 10px; - height: 10px; - display: none; - fill: @colorwhite; - } - } - input:checked ~ .checkbox { - background-color: @colorprimlight; - border: 2px solid @colorprimlight; - .checkmark { - display: block; - } - } - input:checked ~ .preference { - color: @colorwhite; - } - } - } - .language-menu { - margin: 40px 50px; - .language-section { - border-bottom: 1px solid @colormedium; - .headline { - font-weight: 600; - color: @colorwhite40; - } - .selected-language { - height: 40px; - width: 280px; - padding: 20px; + flex-direction: column; + + .toggle-option { display: flex; - margin: 30px 0px; + cursor: pointer; + margin-bottom: 30px; align-items: center; - justify-content: space-between; - font-weight: 600; - color: @colorwhite; - background-color: @colordarkest; - border: 1px solid @colortransparent; - .arrow-down { - width: 8px; - height: 10px; - fill: @colorwhite40; + + .preference { + flex: 1; + white-space: pre; + overflow: hidden; + text-overflow: ellipsis; } - &:hover { + + .default-checkbox { + display: none; + } + + .checkbox { + width: 14px; + height: 14px; cursor: pointer; - border: 1px solid @colormedium; + border: 2px solid @colorwhite60; + + .checkmark { + width: 10px; + height: 10px; + display: none; + fill: @colorwhite; + } + } + + input:checked~.checkbox { + background-color: @colorprimlight; + border: 2px solid @colorprimlight; + + .checkmark { + display: block; + } + } + + input:checked~.preference { + color: @colorwhite; + } + + &:hover { + .preference { + color: @colorwhite; + } + + input:not(:checked)~.checkbox { + border: 2px solid @colorwhite; + } } } + &:not(:last-child) { margin-bottom: 30px; - + border-bottom: 1px solid @colormedium; } } } diff --git a/stories/index.stories.js b/stories/index.stories.js index 5d5b55413..ae7b3a2ca 100644 --- a/stories/index.stories.js +++ b/stories/index.stories.js @@ -5,7 +5,7 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { linkTo } from '@storybook/addon-links'; -import { Addon, LibraryItemList, MetaItem, ShareAddon, Stream, UserPanel, Video } from 'stremio-common'; +import { Addon, Checkbox, LibraryItemList, MetaItem, ShareAddon, Stream, UserPanel, Video } from 'stremio-common'; storiesOf('Addon', module) .add('addon', () => ( @@ -17,6 +17,16 @@ storiesOf('Addon', module)
)); +storiesOf('Checkbox', module) + .add('checkbox', () => ( +
+ + + + +
+ )) + storiesOf('LibraryItemList', module) .add('library item list', () => (