From 6776855cadaec8be5225acb1cc1f56f5433c2a5f Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Thu, 8 Nov 2018 14:48:54 +0530 Subject: [PATCH] Distribute settings in categories and fixes in tab/switch --- src/components/Settings.jsx | 128 +++++++++++++++++++----------------- src/components/Switch.jsx | 24 +++++-- src/components/Tabs.jsx | 3 +- src/components/common.jsx | 4 ++ src/style.css | 48 +++++++++----- 5 files changed, 125 insertions(+), 82 deletions(-) diff --git a/src/components/Settings.jsx b/src/components/Settings.jsx index c52636f..10fb298 100644 --- a/src/components/Settings.jsx +++ b/src/components/Settings.jsx @@ -2,6 +2,7 @@ import { h, Component } from 'preact'; import { editorThemes } from '../editorThemes'; import Switch from './Switch'; import Tabs, { TabPanel } from './Tabs'; +import { Divider } from './common'; function CheckboxSetting({ title, @@ -42,6 +43,56 @@ export default class Settings extends Component {

Settings

+ + + + + + + + + + + + +
+ + - - - - - -
-

- - - -

+ + +

diff --git a/src/components/Switch.jsx b/src/components/Switch.jsx index 7d84bcb..d9a3ebb 100644 --- a/src/components/Switch.jsx +++ b/src/components/Switch.jsx @@ -4,12 +4,26 @@ export default class Switch extends Component { render() { return (

+ +
+ + {this.props.children} ); } diff --git a/src/components/Tabs.jsx b/src/components/Tabs.jsx index 8512a55..efb1625 100644 --- a/src/components/Tabs.jsx +++ b/src/components/Tabs.jsx @@ -44,7 +44,8 @@ export default class Tabs extends Component { let { selectedTab } = this.state; if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') { selectedTab--; - selectedTab = selectedTab < 0 ? this.props.length - 1 : selectedTab; + selectedTab = + selectedTab < 0 ? this.props.children.length - 1 : selectedTab; this.setState({ selectedTab: selectedTab }); e.preventDefault(); } else if (e.key === 'ArrowRight' || e.key === 'ArrowDown') { diff --git a/src/components/common.jsx b/src/components/common.jsx index 4c53f63..90e7b31 100644 --- a/src/components/common.jsx +++ b/src/components/common.jsx @@ -32,3 +32,7 @@ export function AutoFocusInput(props) { el && setTimeout(() => el.focus(), 100)} {...props} /> ); } + +export function Divider(props) { + return
; +} diff --git a/src/style.css b/src/style.css index d9fa624..227d20e 100644 --- a/src/style.css +++ b/src/style.css @@ -212,6 +212,11 @@ hr { label { cursor: pointer; } +.divider { + margin: 10px 0; + height: 1px; + background: rgba(255, 255, 255, 0.1); +} [class*='hint--']:after { text-transform: none; @@ -260,31 +265,35 @@ a > svg { background: rgba(0, 0, 0, 0.1); } +.check-switch .check-switch__toggle { + position: relative; + margin: 0 5px; +} .check-switch .check-switch__toggle:after { background: #fff; + position: absolute; border-radius: 100%; - height: 1.5em; + width: 1.1em; + height: 1.1em; + top: 3px; right: 1.5em; + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5); transition: right 0.1825s ease-in-out; - width: 1.5em; } .check-switch .check-switch__toggle:before, .check-switch .check-switch__toggle:after { - border: 1px solid #565656; content: ''; - position: absolute; - top: 50%; - transform: translateY(-50%); + display: block; } .check-switch .check-switch__toggle:before { - background: #eee; + background: rgba(255, 255, 255, 0.2); border-radius: 1.75em; - height: 1.75em; + width: 2.75em; + height: 1.45em; right: 0.25em; transition: background 0.2s ease-in-out; - width: 2.75em; } .check-switch input:not([role='button']) { @@ -292,31 +301,38 @@ a > svg { } .check-switch input { + width: 100%; height: 100%; + top: 0; left: 0; opacity: 0.0001; position: absolute; - top: 0; - width: 100%; } .check-switch__status { text-transform: uppercase; font-size: 14px; + font-weight: 600; } -.check-switch input:focus + .check-switch__toggle:before { +.check-switch input:focus + * .check-switch__toggle:before { outline: 2px solid; outline-color: var(--color-focus-outline); } -.check-switch input:checked + .check-switch__toggle:after { - right: 0.25em; +.check-switch input:checked + * .check-switch__toggle:after { + right: 0.15em; + left: auto; } -.check-switch input:checked + .check-switch__toggle:before { +.check-switch input:checked + * .check-switch__toggle:before { background: #61ad1c; } +.check-switch__toggle-wrap { + float: right; + display: flex; + align-items: center; +} .btn { display: inline-block; @@ -1907,7 +1923,7 @@ while the theme CSS file is loading */ color: inherit; } .tabs__tab--selected { - background-color: rgba(0, 0, 0, 0.3); + background-color: rgba(0, 0, 0, 0.5); } .tabs__tabpanel-wrap { flex: 1;