diff --git a/packages/app-accounts/src/index.css b/packages/app-accounts/src/index.css deleted file mode 100644 index 85226c208b..0000000000 --- a/packages/app-accounts/src/index.css +++ /dev/null @@ -1,7 +0,0 @@ -/* Copyright 2017-2019 @polkadot/app-accounts authors & contributors -/* This software may be modified and distributed under the terms -/* of the Apache-2.0 license. See the LICENSE file for details. */ - -.accounts--Creator-advanced { - margin-top: 1rem; -} diff --git a/packages/app-accounts/src/index.tsx b/packages/app-accounts/src/index.tsx index bb06dc0d3a..7df34b21e8 100644 --- a/packages/app-accounts/src/index.tsx +++ b/packages/app-accounts/src/index.tsx @@ -13,8 +13,6 @@ import { HelpOverlay, Tabs } from '@polkadot/ui-app'; import { TabItem } from '@polkadot/ui-app/Tabs'; import { withMulti, withObservable } from '@polkadot/ui-api'; -import './index.css'; - import basicMd from './md/basic.md'; import Overview from './Overview'; import translate from './translate'; diff --git a/packages/app-accounts/src/modals/Create.tsx b/packages/app-accounts/src/modals/Create.tsx index 1146b32e5f..57d30b97c5 100644 --- a/packages/app-accounts/src/modals/Create.tsx +++ b/packages/app-accounts/src/modals/Create.tsx @@ -10,6 +10,7 @@ import { ModalProps } from '../types'; import FileSaver from 'file-saver'; import React from 'react'; +import styled from 'styled-components'; import { DEV_PHRASE } from '@polkadot/keyring/defaults'; import { withApi, withMulti } from '@polkadot/ui-api'; import { AddressRow, Button, Dropdown, Input, InputTags, Labelled, Modal, Password } from '@polkadot/ui-app'; @@ -109,10 +110,11 @@ class Create extends React.PureComponent { } render () { - const { t } = this.props; + const { className, t } = this.props; return ( @@ -452,7 +454,11 @@ class Create extends React.PureComponent { } export default withMulti( - Create, + styled(Create)` + .accounts--Creator-advanced { + margin-top: 1rem; + } + `, translate, withApi ); diff --git a/packages/app-address-book/src/index.css b/packages/app-address-book/src/index.css deleted file mode 100644 index 8b33a7bbd3..0000000000 --- a/packages/app-address-book/src/index.css +++ /dev/null @@ -1,7 +0,0 @@ -/* Copyright 2017-2019 @polkadot/app-address-book authors & contributors -/* This software may be modified and distributed under the terms -/* of the Apache-2.0 license. See the LICENSE file for details. */ - -.forgetting-Address { - text-align: center; -} diff --git a/packages/app-address-book/src/index.tsx b/packages/app-address-book/src/index.tsx index 247aafa875..d1842253df 100644 --- a/packages/app-address-book/src/index.tsx +++ b/packages/app-address-book/src/index.tsx @@ -6,8 +6,6 @@ import { AppProps, I18nProps } from '@polkadot/ui-app/types'; import { SubjectInfo } from '@polkadot/ui-keyring/observable/types'; import { ComponentProps } from './types'; -import './index.css'; - import React from 'react'; import { Route, Switch } from 'react-router'; import addressObservable from '@polkadot/ui-keyring/observable/addresses'; diff --git a/packages/app-address-book/src/modals/Forgetting.tsx b/packages/app-address-book/src/modals/Forgetting.tsx index fd9400d114..45b7f6f276 100644 --- a/packages/app-address-book/src/modals/Forgetting.tsx +++ b/packages/app-address-book/src/modals/Forgetting.tsx @@ -67,7 +67,7 @@ class Forgetting extends React.PureComponent { : undefined; return ( - + { }; } - static getDerivedStateFromProps ({ value }: Props): State | null { + static getDerivedStateFromProps ({ value }: Props) { const Component = Query.getCachedComponent(value).Component; const inputs: Array = isU8a(value.key) ? [] @@ -104,7 +105,7 @@ class Query extends React.PureComponent { } render () { - const { value } = this.props; + const { className, value } = this.props; const { Component } = this.state; const { key } = value; const type = isU8a(key) @@ -116,7 +117,7 @@ class Query extends React.PureComponent { ); return ( -
+
{ } } -export default translate(Query); +export default translate(styled(Query as React.ComponentClass)` + margin-bottom: 0.25em; + + .ui.disabled.dropdown.selection { + color: #aaa; + opacity: 1; + } + + .ui--IdentityIcon { + margin: -10px 0; + vertical-align: middle; + } +`); diff --git a/packages/app-storage/src/index.css b/packages/app-storage/src/index.css index cfb819cd66..8419bbb037 100644 --- a/packages/app-storage/src/index.css +++ b/packages/app-storage/src/index.css @@ -2,20 +2,6 @@ /* This software may be modified and distributed under the terms /* of the Apache-2.0 license. See the LICENSE file for details. */ -.storage--Query { - margin-bottom: 0.25em; - - .ui.disabled.dropdown.selection { - color: #aaa; - opacity: 1; - } - - .ui--IdentityIcon { - margin: -10px 0; - vertical-align: middle; - } -} - .storage--actionrow { align-items: center; display: flex; diff --git a/packages/apps/src/Apps.tsx b/packages/apps/src/Apps.tsx index 0556a73e0c..3f97d3a556 100644 --- a/packages/apps/src/Apps.tsx +++ b/packages/apps/src/Apps.tsx @@ -10,7 +10,7 @@ import { BareProps } from '@polkadot/ui-app/types'; import React from 'react'; import store from 'store'; -import styled, { ThemeProvider } from 'styled-components'; +import styled from 'styled-components'; import { media } from '@polkadot/ui-app'; import Signer from '@polkadot/ui-signer'; import settings from '@polkadot/ui-settings'; @@ -30,23 +30,7 @@ type State = { transition: SideBarTransition }; -const Wrapper = styled.div` - align-items: stretch; - box-sizing: border-box; - display: flex; - min-height: 100vh; - - header { - margin-bottom: 1.4rem; - text-align: center; - - ${media.TABLET` - margin-bottom: 2rem; - `} - } -`; - -export default class Apps extends React.Component { +class Apps extends React.Component { state: State; constructor (props: Props) { @@ -74,26 +58,25 @@ export default class Apps extends React.Component { } render () { + const { className } = this.props; const { isCollapsed, isMenu, menuOpen } = this.state; return ( - - - {this.renderMenuBg()} - - - - - - - - +
+ {this.renderMenuBg()} + + + + + + +
); } @@ -193,3 +176,19 @@ export default class Apps extends React.Component { } } } + +export default styled(Apps)` + align-items: stretch; + box-sizing: border-box; + display: flex; + min-height: 100vh; + + header { + margin-bottom: 1.4rem; + text-align: center; + + ${media.TABLET` + margin-bottom: 2rem; + `} + } +`; diff --git a/packages/apps/src/index.tsx b/packages/apps/src/index.tsx index 9005e373ed..d706e5ba90 100644 --- a/packages/apps/src/index.tsx +++ b/packages/apps/src/index.tsx @@ -2,7 +2,9 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +// import first, get the load done import settings from '@polkadot/ui-settings'; + import '@polkadot/ui-app/i18n'; import '@polkadot/ui-app/styles'; @@ -10,11 +12,12 @@ import React, { Suspense } from 'react'; import ReactDOM from 'react-dom'; import { HashRouter } from 'react-router-dom'; import store from 'store'; +import { ThemeProvider } from 'styled-components'; import { getTypeRegistry } from '@polkadot/types'; import { Api } from '@polkadot/ui-api'; - import { QueueConsumer } from '@polkadot/ui-app/Status/Context'; import Queue from '@polkadot/ui-app/Status/Queue'; + import Apps from './Apps'; const rootId = 'root'; @@ -39,6 +42,10 @@ try { console.error('Type registration failed', error); } +const theme = { + theme: settings.uiTheme +}; + ReactDOM.render( @@ -50,7 +57,9 @@ ReactDOM.render( url={url} > - + + + )} diff --git a/packages/ui-app/src/Button/Button.css b/packages/ui-app/src/Button/Button.css index 1f5f0d587e..cb314c9573 100644 --- a/packages/ui-app/src/Button/Button.css +++ b/packages/ui-app/src/Button/Button.css @@ -2,19 +2,7 @@ /* This software may be modified and distributed under the terms /* of the Apache-2.0 license. See the LICENSE file for details. */ -.ui--Button-Group { - text-align: right; - - &.centered { - margin-bottom: 0.5rem; - text-align: center; - } -} - -.ui--Button-Group:not(:first-child) { - margin-top: 0.75rem; -} - +/* not sure where, why... */ br+.ui--Button-Group { margin-top: 0; } diff --git a/packages/ui-app/src/Button/Group.tsx b/packages/ui-app/src/Button/Group.tsx index 8835c45431..335f3d2bb7 100644 --- a/packages/ui-app/src/Button/Group.tsx +++ b/packages/ui-app/src/Button/Group.tsx @@ -6,6 +6,7 @@ import { GroupProps, GroupType } from './types'; import React from 'react'; import SUIButton from 'semantic-ui-react/dist/commonjs/elements/Button/Button'; +import styled from 'styled-components'; import { classes } from '../util'; import Divider from './Divider'; @@ -34,4 +35,15 @@ class ButtonGroup extends React.PureComponent { (ButtonGroup as GroupType).Divider = Divider; -export default (ButtonGroup as GroupType); +export default styled(ButtonGroup)` + text-align: right; + + :not(:first-child) { + margin-top: 0.75rem; + } + + &.centered { + margin-bottom: 0.5rem; + text-align: center; + } +` as any as GroupType; diff --git a/packages/ui-app/src/Editor/index.tsx b/packages/ui-app/src/Editor.tsx similarity index 79% rename from packages/ui-app/src/Editor/index.tsx rename to packages/ui-app/src/Editor.tsx index 7f7971379b..fe29942a24 100644 --- a/packages/ui-app/src/Editor/index.tsx +++ b/packages/ui-app/src/Editor.tsx @@ -4,11 +4,10 @@ import { BareProps } from '@polkadot/ui-app/types'; -import React from 'react'; -import { classes } from '@polkadot/ui-app/util'; import CodeFlask from 'codeflask'; - -import './style.css'; +import React from 'react'; +import styled from 'styled-components'; +import { classes } from '@polkadot/ui-app/util'; type Props = BareProps & { code: string, @@ -35,8 +34,7 @@ type Props = BareProps & { * /> * ``` */ - -export default class Editor extends React.Component { +class Editor extends React.Component { private id: string = `flask-${Date.now()}`; private editor: any; @@ -70,9 +68,23 @@ export default class Editor extends React.Component { return (
); } } + +export default styled(Editor)` + .codeflask { + border: 1px solid rgba(34,36,38,.15); + background: transparent; + } + + &.invalid { + .codeflask { + background-color: #fff6f6; + border-color: #e0b4b4; + } + } +`; diff --git a/packages/ui-app/src/Editor/style.css b/packages/ui-app/src/Editor/style.css deleted file mode 100644 index f6c0d18dfb..0000000000 --- a/packages/ui-app/src/Editor/style.css +++ /dev/null @@ -1,13 +0,0 @@ -.ui-app-editor { - .codeflask { - border: 1px solid rgba(34,36,38,.15); - background: transparent; - } - - &.invalid { - .codeflask { - background-color: #fff6f6; - border-color: #e0b4b4; - } - } -} \ No newline at end of file diff --git a/packages/ui-app/src/InputAddress/index.tsx b/packages/ui-app/src/InputAddress.tsx similarity index 92% rename from packages/ui-app/src/InputAddress/index.tsx rename to packages/ui-app/src/InputAddress.tsx index 480359eb12..e5f99a7008 100644 --- a/packages/ui-app/src/InputAddress/index.tsx +++ b/packages/ui-app/src/InputAddress.tsx @@ -3,20 +3,19 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { KeyringOptions, KeyringSectionOption, KeyringSectionOptions, KeyringOption$Type } from '@polkadot/ui-keyring/options/types'; -import { BareProps } from '../types'; - -import './InputAddress.css'; +import { BareProps } from './types'; import React from 'react'; import store from 'store'; +import styled from 'styled-components'; import keyring from '@polkadot/ui-keyring'; import keyringOption from '@polkadot/ui-keyring/options'; import createItem from '@polkadot/ui-keyring/options/item'; import { withMulti, withObservable } from '@polkadot/ui-api'; -import Dropdown from '../Dropdown'; -import { classes, getAddrName } from '../util'; -import addressToAddress from '../util/toAddress'; +import Dropdown from './Dropdown'; +import { classes, getAddrName } from './util'; +import addressToAddress from './util/toAddress'; type Props = BareProps & { defaultValue?: string | null, @@ -151,7 +150,7 @@ class InputAddress extends React.PureComponent { return ( { export { InputAddress }; export default withMulti( - InputAddress, + styled(InputAddress)` + .ui.dropdown .text { + width: 100%; + } + + .ui.search.selection.dropdown > input.search { + padding-left: 4rem; + } + + &.hideAddress .ui--KeyPair .ui--KeyPair-address { + flex: 0; + max-width: 0; + } + `, withObservable(keyringOption.optionsSubject, { propName: 'optionsAll' }) ); diff --git a/packages/ui-app/src/InputAddress/InputAddress.css b/packages/ui-app/src/InputAddress/InputAddress.css deleted file mode 100644 index 624626df21..0000000000 --- a/packages/ui-app/src/InputAddress/InputAddress.css +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright 2017-2019 @polkadot/ui-app authors & contributors -/* This software may be modified and distributed under the terms -/* of the Apache-2.0 license. See the LICENSE file for details. */ - -.ui--InputAddress {} - -.ui--InputAddress .ui.dropdown .text { - width: 100%; -} - -.ui--InputAddress .ui.search.selection.dropdown > input.search { - padding-left: 4rem; -} - -.flag--hideAddress .ui--KeyPair .ui--KeyPair-address { - flex: 0; - max-width: 0; -} diff --git a/packages/ui-app/src/Editor/codeflask.d.ts b/packages/ui-app/src/codeflask.d.ts similarity index 100% rename from packages/ui-app/src/Editor/codeflask.d.ts rename to packages/ui-app/src/codeflask.d.ts