From 28dbe3d1049410b39dce315aa47b95a4910f8199 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Sat, 29 Aug 2020 10:56:10 +0200 Subject: [PATCH] Staking ledgend v1 (#3564) * Staking ledgend v1 * Re-add clickable icon spacing --- packages/page-staking/src/Filtering.tsx | 2 + packages/page-staking/src/Ledgend.tsx | 78 +++++++++++++++++++++ packages/page-staking/src/Targets/index.tsx | 2 +- 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 packages/page-staking/src/Ledgend.tsx diff --git a/packages/page-staking/src/Filtering.tsx b/packages/page-staking/src/Filtering.tsx index 6ad13c6e0e..fa07c48a02 100644 --- a/packages/page-staking/src/Filtering.tsx +++ b/packages/page-staking/src/Filtering.tsx @@ -9,6 +9,7 @@ import { useApi } from '@polkadot/react-hooks'; import { isString } from '@polkadot/util'; import { useTranslation } from './translate'; +import Ledgend from './Ledgend'; interface Props { children?: React.ReactNode; @@ -52,6 +53,7 @@ function Filtering ({ children, className, nameFilter, setNameFilter, setWithIde value={withIdentity} /> )} + ); diff --git a/packages/page-staking/src/Ledgend.tsx b/packages/page-staking/src/Ledgend.tsx new file mode 100644 index 0000000000..775f243070 --- /dev/null +++ b/packages/page-staking/src/Ledgend.tsx @@ -0,0 +1,78 @@ +// Copyright 2017-2020 @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. + +import React from 'react'; +import styled from 'styled-components'; +import { Badge, Icon } from '@polkadot/react-components'; + +import { useTranslation } from './translate'; + +interface Props { + className?: string; +} + +function Ledgend ({ className }: Props): React.ReactElement { + const { t } = useTranslation(); + + return ( +
+ + + {t('Next session')} + + + + {t('Produced blocks')} + + + } + /> + {t('Online message')} + + + + {t('Nominating')} + + + + {t('Oversubscribed')} + + + + {t('Slashed')} + +
+ ); +} + +export default React.memo(styled(Ledgend)` + font-size: 0.85rem; + padding: 1rem 0.5rem 0.5rem; + text-align: center; + + .ui--Badge { + margin-right: 0.5rem; + } + + span+span { + margin-left: 1rem; + } +`); diff --git a/packages/page-staking/src/Targets/index.tsx b/packages/page-staking/src/Targets/index.tsx index 9bd32e04be..e241600c87 100644 --- a/packages/page-staking/src/Targets/index.tsx +++ b/packages/page-staking/src/Targets/index.tsx @@ -225,7 +225,7 @@ function Targets ({ className = '', isInElection, ownStashes, targets: { avgStak export default React.memo(styled(Targets)` text-align: center; - th { + th.isClickable { .ui--Icon { margin-left: 0.5rem; }