Some more css -> styled conversions (#1677)
This commit is contained in:
parent
d40d58fb10
commit
0e70ce1b8b
@ -4,10 +4,9 @@
|
||||
|
||||
import { BareProps } from '@polkadot/react-components/types';
|
||||
|
||||
import './BlockHeader.css';
|
||||
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import styled from 'styled-components';
|
||||
import { HeaderExtended } from '@polkadot/api-derive';
|
||||
import { AddressMini, LinkPolkascan } from '@polkadot/react-components';
|
||||
import { formatNumber } from '@polkadot/util';
|
||||
@ -44,7 +43,7 @@ const renderDetails = ({ number: blockNumber, extrinsicsRoot, parentHash, stateR
|
||||
);
|
||||
};
|
||||
|
||||
export default function BlockHeader ({ isSummary, value, withExplorer, withLink }: Props): React.ReactElement<Props> | null {
|
||||
function BlockHeader ({ className, isSummary, value, withExplorer, withLink }: Props): React.ReactElement<Props> | null {
|
||||
if (!value) {
|
||||
return null;
|
||||
}
|
||||
@ -53,7 +52,7 @@ export default function BlockHeader ({ isSummary, value, withExplorer, withLink
|
||||
const textNumber = formatNumber(value.number);
|
||||
|
||||
return (
|
||||
<article className='explorer--BlockHeader'>
|
||||
<article className={`explorer--BlockHeader ${className}`}>
|
||||
<div className='header-outer'>
|
||||
<div className='header'>
|
||||
<div className='number'>{
|
||||
@ -82,3 +81,85 @@ export default function BlockHeader ({ isSummary, value, withExplorer, withLink
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
export default styled(BlockHeader)`
|
||||
.author {
|
||||
font-size: 1rem;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
|
||||
> .ui--AddressMini.padded {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
text-align: left;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
|
||||
> div {
|
||||
display: inline-block;
|
||||
font-weight: 100;
|
||||
vertical-align: middle;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
> .number {
|
||||
font-size: 2.25rem;
|
||||
}
|
||||
|
||||
.hash {
|
||||
font-size: 1.5rem;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
}
|
||||
|
||||
.hash {
|
||||
font-family: monospace;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.number {
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.contains {
|
||||
border: 0;
|
||||
margin-top: 0.5rem;
|
||||
text-align: center;
|
||||
|
||||
> .info {
|
||||
margin-bottom: 0.125em;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
.ui--Labelled {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
> label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
> span,
|
||||
> label {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
label {
|
||||
margin-right: 0.5rem;
|
||||
min-width: 10rem;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -1,90 +0,0 @@
|
||||
/* Copyright 2017-2019 @polkadot/app-explorer authors & contributors
|
||||
/* This software may be modified and distributed under the terms
|
||||
/* of the Apache-2.0 license. See the LICENSE file for details. */
|
||||
|
||||
header > .explorer--BlockHeader {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.explorer--BlockHeader {
|
||||
.author {
|
||||
font-size: 1rem;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
|
||||
> .ui--AddressMini.padded {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
text-align: left;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
|
||||
> div {
|
||||
display: inline-block;
|
||||
font-weight: 100;
|
||||
vertical-align: middle;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
> .number {
|
||||
font-size: 2.25rem;
|
||||
}
|
||||
|
||||
.hash {
|
||||
font-size: 1.5rem;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
}
|
||||
|
||||
.hash {
|
||||
font-family: monospace;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.number {
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.contains {
|
||||
border: 0;
|
||||
margin-top: 0.5rem;
|
||||
text-align: center;
|
||||
|
||||
> .info {
|
||||
margin-bottom: 0.125em;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
.ui--Labelled {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
> label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
> span,
|
||||
> label {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
label {
|
||||
margin-right: 0.5rem;
|
||||
min-width: 10rem;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ import { EventRecord, SignedBlock } from '@polkadot/types/interfaces';
|
||||
import { I18nProps } from '@polkadot/react-components/types';
|
||||
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { HeaderExtended } from '@polkadot/api-derive';
|
||||
import { withCalls } from '@polkadot/react-api';
|
||||
import { Columar } from '@polkadot/react-components';
|
||||
@ -24,15 +25,16 @@ interface Props extends I18nProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
function BlockByHash ({ system_events, chain_getBlock, chain_getHeader }: Props): React.ReactElement<Props> | null {
|
||||
function BlockByHash ({ className, system_events, chain_getBlock, chain_getHeader }: Props): React.ReactElement<Props> | null {
|
||||
if (!chain_getBlock || chain_getBlock.isEmpty || !chain_getHeader || chain_getHeader.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={className}>
|
||||
<header>
|
||||
<BlockHeader
|
||||
className='exporer--BlockByHash-BlockHeader'
|
||||
value={chain_getHeader}
|
||||
withExplorer
|
||||
/>
|
||||
@ -45,7 +47,7 @@ function BlockByHash ({ system_events, chain_getBlock, chain_getHeader }: Props)
|
||||
<Events value={system_events} />
|
||||
<Logs value={chain_getHeader.digest.logs} />
|
||||
</Columar>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -54,5 +56,10 @@ export default translate(
|
||||
['rpc.chain.getBlock', { paramName: 'value' }],
|
||||
['derive.chain.getHeader', { paramName: 'value' }],
|
||||
['query.system.events', { atProp: 'value' }]
|
||||
)(BlockByHash)
|
||||
)(styled(BlockByHash)`
|
||||
.exporer--BlockByHash-BlockHeader {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
`)
|
||||
);
|
||||
|
||||
@ -6,6 +6,7 @@ import { PeerInfo } from '@polkadot/types/interfaces';
|
||||
import { I18nProps } from '@polkadot/react-components/types';
|
||||
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { formatNumber } from '@polkadot/util';
|
||||
|
||||
import translate from './translate';
|
||||
@ -27,9 +28,9 @@ const renderPeer = (peer: PeerInfo): React.ReactNode => {
|
||||
);
|
||||
};
|
||||
|
||||
function Peers ({ peers, t }: Props): React.ReactElement<Props> {
|
||||
function Peers ({ className, peers, t }: Props): React.ReactElement<Props> {
|
||||
return (
|
||||
<section className='status--Peers'>
|
||||
<section className={`status--Peers ${className}`}>
|
||||
<h1>{t('connected peers')}</h1>
|
||||
{peers && peers.length
|
||||
? (
|
||||
@ -62,4 +63,47 @@ function Peers ({ peers, t }: Props): React.ReactElement<Props> {
|
||||
);
|
||||
}
|
||||
|
||||
export default translate(Peers);
|
||||
export default translate(
|
||||
styled(Peers)`
|
||||
table {
|
||||
width: 100%;
|
||||
|
||||
td, th {
|
||||
padding: 0.25rem 0.5rem;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
|
||||
&.hash {
|
||||
font-family: monospace;
|
||||
max-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&.number {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
&.peerid {
|
||||
font-style: italic;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
&.roles {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tbody {
|
||||
tr {
|
||||
width: 100%;
|
||||
|
||||
&:nth-child(odd) {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
);
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
/* Copyright 2017-2019 @polkadot/app-nodeinfo authors & contributors
|
||||
/* This software may be modified and distributed under the terms
|
||||
/* of the Apache-2.0 license. See the LICENSE file for details. */
|
||||
|
||||
.status--Peers {
|
||||
table {
|
||||
width: 100%;
|
||||
|
||||
td, th {
|
||||
padding: 0.25rem 0.5rem;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
|
||||
&.hash {
|
||||
font-family: monospace;
|
||||
max-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&.number {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
&.peerid {
|
||||
font-style: italic;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
&.roles {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tbody {
|
||||
tr {
|
||||
width: 100%;
|
||||
|
||||
&:nth-child(odd) {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,8 +9,6 @@ import React, { useContext, useEffect, useState } from 'react';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { ApiContext } from '@polkadot/react-api';
|
||||
|
||||
import './index.css';
|
||||
|
||||
import Extrinsics from '../BlockInfo/Extrinsics';
|
||||
import Peers from './Peers';
|
||||
import Summary from './Summary';
|
||||
|
||||
@ -2,11 +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--BlockByHash-block {
|
||||
flex: 0 0 50%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.explorer--Container {
|
||||
color: inherit;
|
||||
|
||||
|
||||
@ -7,8 +7,6 @@ import { AppProps, BareProps, I18nProps } from '@polkadot/react-components/types
|
||||
import { EventRecord } from '@polkadot/types/interfaces';
|
||||
import { KeyedEvent } from './types';
|
||||
|
||||
import './index.css';
|
||||
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import { Route, Switch } from 'react-router';
|
||||
import styled from 'styled-components';
|
||||
@ -40,31 +38,27 @@ function ExplorerApp ({ basePath, className, newEvents, newHeader, t }: Props):
|
||||
useEffect((): void => {
|
||||
const newEventHash = xxhashAsHex(stringToU8a(JSON.stringify(newEvents)));
|
||||
|
||||
if (newEventHash === prevEventHash || !newEvents) {
|
||||
return;
|
||||
if (newEventHash !== prevEventHash && newEvents) {
|
||||
setEvents({
|
||||
prevEventHash: newEventHash,
|
||||
events: newEvents.concat(events).filter((_, index): boolean => index < MAX_ITEMS)
|
||||
});
|
||||
}
|
||||
|
||||
setEvents({
|
||||
prevEventHash: newEventHash,
|
||||
events: newEvents.concat(events).filter((_, index): boolean => index < MAX_ITEMS)
|
||||
});
|
||||
}, [newEvents]);
|
||||
|
||||
useEffect((): void => {
|
||||
if (!newHeader) {
|
||||
return;
|
||||
if (newHeader) {
|
||||
setHeaders(
|
||||
headers
|
||||
.filter((old, index): boolean => index < MAX_ITEMS && old.number.unwrap().lt(newHeader.number.unwrap()))
|
||||
.reduce((next, header): HeaderExtended[] => {
|
||||
next.push(header);
|
||||
|
||||
return next;
|
||||
}, [newHeader])
|
||||
.sort((a, b): number => b.number.unwrap().cmp(a.number.unwrap()))
|
||||
);
|
||||
}
|
||||
|
||||
setHeaders(
|
||||
headers
|
||||
.filter((old, index): boolean => index < MAX_ITEMS && old.number.unwrap().lt(newHeader.number.unwrap()))
|
||||
.reduce((next, header): HeaderExtended[] => {
|
||||
next.push(header);
|
||||
|
||||
return next;
|
||||
}, [newHeader])
|
||||
.sort((a, b): number => b.number.unwrap().cmp(a.number.unwrap()))
|
||||
);
|
||||
}, [newHeader]);
|
||||
|
||||
return (
|
||||
@ -104,14 +98,12 @@ function ExplorerApp ({ basePath, className, newEvents, newHeader, t }: Props):
|
||||
<Route path={`${basePath}/query/:value`} component={BlockInfo} />
|
||||
<Route path={`${basePath}/query`} component={BlockInfo} />
|
||||
<Route path={`${basePath}/node`} component={NodeInfo} />
|
||||
<Route
|
||||
render={(): React.ReactElement<{}> =>
|
||||
<Main
|
||||
events={events}
|
||||
headers={headers}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Route render={(): React.ReactElement<{}> => (
|
||||
<Main
|
||||
events={events}
|
||||
headers={headers}
|
||||
/>
|
||||
)} />
|
||||
</Switch>
|
||||
</main>
|
||||
);
|
||||
|
||||
@ -608,14 +608,22 @@ export default withMulti(
|
||||
width: 0px;
|
||||
}
|
||||
|
||||
.staking--Account-detail.actions{
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-top: .5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
.staking--Account-detail {
|
||||
text-align: right;
|
||||
|
||||
&:last-child {
|
||||
margin: 0;
|
||||
&.actions{
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-top: .5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
|
||||
&:last-child {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.staking--label {
|
||||
margin: 0 1.75rem -0.75rem 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -218,6 +218,16 @@ export default withMulti(
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.staking--Address-info {
|
||||
/* Small additional margin to take care of validator highlights */
|
||||
margin-right: 0.25rem;
|
||||
text-align: right;
|
||||
|
||||
.staking--label {
|
||||
margin: 0 2.25rem -0.75rem 0;
|
||||
}
|
||||
}
|
||||
|
||||
.staking--label.controllerSpacer {
|
||||
margin-top: 2.75rem;
|
||||
}
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
/* Copyright 2017-2019 @polkadot/app-staking authors & contributors
|
||||
/* This software may be modified and distributed under the terms
|
||||
/* of the Apache-2.0 license. See the LICENSE file for details. */
|
||||
|
||||
.staking--Account-links {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.staking--Account-detail {
|
||||
text-align: right;
|
||||
|
||||
.staking--label {
|
||||
margin: 0 1.75rem -0.75rem 0;
|
||||
}
|
||||
}
|
||||
|
||||
.staking--Address-info {
|
||||
/* Small additional margin to take care of validator highlights */
|
||||
margin-right: 0.25rem;
|
||||
text-align: right;
|
||||
|
||||
.staking--label {
|
||||
margin: 0 2.25rem -0.75rem 0;
|
||||
}
|
||||
}
|
||||
@ -18,8 +18,6 @@ import Tabs from '@polkadot/react-components/Tabs';
|
||||
import { withCalls, withMulti, withObservable } from '@polkadot/react-api';
|
||||
import accountObservable from '@polkadot/ui-keyring/observable/accounts';
|
||||
|
||||
import './index.css';
|
||||
|
||||
import Accounts from './Actions/Accounts';
|
||||
import basicMd from './md/basic.md';
|
||||
import Overview from './Overview';
|
||||
|
||||
@ -2,12 +2,6 @@
|
||||
/* This software may be modified and distributed under the terms
|
||||
/* of the Apache-2.0 license. See the LICENSE file for details. */
|
||||
|
||||
.ui--signer-Signer-Decoded {
|
||||
align-content: center;
|
||||
display: flex;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.ui--signer-Signer-Content {
|
||||
.modal-Text {
|
||||
margin-bottom: 1em;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user