Style cleanups (styled & unused) (#1151)

This commit is contained in:
Jaco Greeff 2019-05-14 11:04:49 +02:00 committed by GitHub
parent c36d1840a0
commit 2596c3c940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 54 additions and 73 deletions

View File

@ -6,6 +6,7 @@ import { I18nProps } from '@polkadot/ui-app/types';
import { KeyedEvent } from './types';
import React from 'react';
import styled from 'styled-components';
import BlockHeaders from './BlockHeaders';
import Events from './Events';
@ -17,6 +18,14 @@ type Props = I18nProps & {
events: Array<KeyedEvent>
};
const Wrapper = styled.div`
.column {
flex: 0 0 50%;
min-width: 0;
padding: 0 1em 1em;
}
`;
class Main extends React.PureComponent<Props> {
render () {
const { events, t } = this.props;
@ -25,7 +34,7 @@ class Main extends React.PureComponent<Props> {
<>
<Query />
<Summary />
<div className='explorer--Overview ui--flex-medium'>
<Wrapper className='ui--flex-medium'>
<div className='column'>
<h1>{t('recent blocks')}</h1>
<BlockHeaders />
@ -34,7 +43,7 @@ class Main extends React.PureComponent<Props> {
<h1>{t('recent events')}</h1>
<Events events={events} />
</div>
</div>
</Wrapper>
</>
);
}

View File

@ -2,34 +2,6 @@
/* This software may be modified and distributed under the terms
/* of the Apache-2.0 license. See the LICENSE file for details. */
.explorer--App .rx--updated {
background: transparent !important;
}
.explorer--BestHash,
.explorer--BestNumber {
font-weight: 100;
text-align: right;
opacity: 0.5;
}
.explorer--BestHash.rx--updated,
.explorer--BestNumber.rx--updated {
opacity: 1;
}
.explorer--BestHash {
font-size: 1.5em;
line-height: 1.2;
}
.explorer--BestNumber {
font-size: 2.25rem;
line-height: 2.25rem;
position: relative;
text-align: right;
}
.explorer--BlockByHash-flexable {
flex-wrap: wrap;
margin-top: -0.5rem;
@ -86,14 +58,6 @@
right: 0rem;
}
.explorer--Overview {
.column {
flex: 0 0 50%;
min-width: 0;
padding: 0 1em 1em;
}
}
.explorer--query {
width: 20em;
}

View File

@ -9,6 +9,7 @@ import './index.css';
import React from 'react';
import { Route, Switch } from 'react-router';
import styled from 'styled-components';
import { EventRecord } from '@polkadot/types';
import { withCalls, withMulti } from '@polkadot/ui-api';
import Tabs, { TabItem } from '@polkadot/ui-app/Tabs';
@ -32,6 +33,12 @@ type State = {
recentEvents: Array<KeyedEvent>;
};
const Wrapper = styled.main`
.rx--updated {
background: transparent !important;
}
`;
class ExplorerApp extends React.Component<Props, State> {
constructor (props: Props) {
super(props);
@ -89,7 +96,7 @@ class ExplorerApp extends React.Component<Props, State> {
: ['node'];
return (
<main className='explorer--App'>
<Wrapper>
<header>
<Tabs
basePath={basePath}
@ -103,7 +110,7 @@ class ExplorerApp extends React.Component<Props, State> {
<Route path={`${basePath}/node`} component={NodeInfo} />
<Route component={this.renderMain} />
</Switch>
</main>
</Wrapper>
);
}

View File

@ -4,16 +4,16 @@
.storage--Query {
margin-bottom: 0.25em;
}
.storage--Query .ui.disabled.dropdown.selection {
color: #aaa;
opacity: 1;
}
.ui.disabled.dropdown.selection {
color: #aaa;
opacity: 1;
}
.storage--Query .ui--IdentityIcon {
margin: -10px 0;
vertical-align: middle;
.ui--IdentityIcon {
margin: -10px 0;
vertical-align: middle;
}
}
.storage--actionrow {

View File

@ -72,9 +72,10 @@ class Hash extends React.PureComponent<Props, State> {
return (
<div className='ui--row'>
<Output
className='full toolbox--hex'
isHidden={hash.length === 0}
className='full'
help={t('The blake2b 256-bit hash of the actual input data.')}
isHidden={hash.length === 0}
isMonospace
label={t('the resulting hash is')}
value={hash}
withCopy

View File

@ -135,9 +135,10 @@ class Sign extends React.PureComponent<Props, State> {
return (
<div className='ui--row'>
<Output
className='full toolbox--hex'
isHidden={signature.length === 0}
className='full'
help={t('The resulting signature of the input data, as done with the crypto algorithm from the account. (This could be non-deterministic for some types such as sr25519).')}
isHidden={signature.length === 0}
isMonospace
label={t('signature of supplied data')}
value={signature}
withCopy

View File

@ -1,7 +0,0 @@
/* Copyright 2017-2019 @polkadot/app-toolbox authors & contributors
/* This software may be modified and distributed under the terms
/* of the Apache-2.0 license. See the LICENSE file for details. */
.toolbox--hex .ui--output {
font-family: monospace;
}

View File

@ -5,8 +5,6 @@
import { AppProps, I18nProps } from '@polkadot/ui-app/types';
import { SubjectInfo } from '@polkadot/ui-keyring/observable/types';
import './index.css';
import React from 'react';
import { Route, Switch } from 'react-router';
import Tabs, { TabItem } from '@polkadot/ui-app/Tabs';

View File

@ -15,6 +15,7 @@ type Props = BareProps & {
help?: React.ReactNode,
isError?: boolean,
isHidden?: boolean,
isMonospace?: boolean,
label?: any, // node?
value?: any,
withCopy?: boolean,
@ -23,7 +24,7 @@ type Props = BareProps & {
export default class Output extends React.PureComponent<Props> {
render () {
const { className, children, help, isError = false, isHidden, label, style, value, withCopy = false, withLabel } = this.props;
const { className, children, help, isError, isHidden, isMonospace, label, style, value, withCopy = false, withLabel } = this.props;
return (
<Labelled
@ -34,13 +35,16 @@ export default class Output extends React.PureComponent<Props> {
style={style}
withLabel={withLabel}
>
<div className={classes('ui--output', isError && 'error')}>
<div className={classes('ui--output', isError && 'error', isMonospace && 'monospace')}>
{value}
{children}
{
withCopy
? (
<CopyButton className='ui--output-button' value={value} />
<CopyButton
className='ui--output-button'
value={value}
/>
)
: null
}

View File

@ -14,17 +14,21 @@
padding: .75rem 1rem;
position: relative;
word-wrap: break-word;
}
.ui--output .ui--output-button {
position: absolute;
top: 0.25rem;
right: 0.25rem;
}
&.error {
background: #fff6f6;
border-color: #e0b4b4;
}
.ui--output.error {
background: #fff6f6;
border-color: #e0b4b4;
&.monospace {
font-family: monospace;
}
.ui--output-button {
position: absolute;
top: 0.25rem;
right: 0.25rem;
}
}
.ui--Button-Group .button {