From 9a3489e54f8ee57e45924b715ac2a5518db6c9a7 Mon Sep 17 00:00:00 2001 From: Ross Bulat Date: Wed, 3 Apr 2019 22:32:16 +0800 Subject: [PATCH] Tabs Simplify and Summary Tidy-up (#885) * tabs simple * remove min width * 3 stats iphone size * node info media-small * spacing * center stat * iphone SE size summary support * line-height, safari UI bug * mob spacing (uhoh, @media queries building up) * trailing whitespace * normalise media breakpoints * nits * padding, rem-ing * trailing whitespace --- .../app-explorer/src/NodeInfo/Summary.tsx | 12 ++++-- packages/app-explorer/src/Summary.tsx | 7 +++- packages/apps/src/Content/index.tsx | 11 +++++- packages/ui-app/src/CardSummary.tsx | 38 ++++++++++++++----- packages/ui-app/src/SummaryBox.tsx | 28 ++++---------- packages/ui-app/src/styles/app.css | 7 +++- packages/ui-app/src/styles/media.css | 4 +- packages/ui-app/src/styles/semantic.css | 21 ++++++++-- packages/ui-app/src/styles/theme/polkadot.css | 4 ++ 9 files changed, 89 insertions(+), 43 deletions(-) diff --git a/packages/app-explorer/src/NodeInfo/Summary.tsx b/packages/app-explorer/src/NodeInfo/Summary.tsx index c8156e54d2..da7f9cfc8a 100644 --- a/packages/app-explorer/src/NodeInfo/Summary.tsx +++ b/packages/app-explorer/src/NodeInfo/Summary.tsx @@ -45,18 +45,24 @@ class Summary extends React.PureComponent { return ( -
+
- + { info.health ? `${info.health.peers.toNumber()}` : '-' } - + { info.health ? ( diff --git a/packages/app-explorer/src/Summary.tsx b/packages/app-explorer/src/Summary.tsx index 84aea392dd..01e888b648 100644 --- a/packages/app-explorer/src/Summary.tsx +++ b/packages/app-explorer/src/Summary.tsx @@ -19,8 +19,11 @@ class Summary extends React.PureComponent { return ( -
- +
+ diff --git a/packages/apps/src/Content/index.tsx b/packages/apps/src/Content/index.tsx index b60b34f1cf..0baa23e99a 100644 --- a/packages/apps/src/Content/index.tsx +++ b/packages/apps/src/Content/index.tsx @@ -31,6 +31,15 @@ const Wrapper = styled.div` overflow-x: hidden; overflow-y: auto; width: 100%; + padding: 0 2rem; + + @media(max-width: 768px) { + padding: 0 0.5rem; + } +`; + +const Connecting = styled.div` + padding: 1rem 0; `; const unknown = { @@ -52,7 +61,7 @@ class Content extends React.Component { if (needsApi && (!isApiReady || !isApiConnected)) { return ( -
{t('Waiting for API to be connected and ready.')}
+ {t('Waiting for API to be connected and ready.')}
); } diff --git a/packages/ui-app/src/CardSummary.tsx b/packages/ui-app/src/CardSummary.tsx index 08f340ec9b..a2b8cc050d 100644 --- a/packages/ui-app/src/CardSummary.tsx +++ b/packages/ui-app/src/CardSummary.tsx @@ -17,7 +17,6 @@ import styled from 'styled-components'; const Card = styled.article` align-items: center; box-shadow: none; - background: none; color: rgba(0, 0, 0, 0.6); display: flex; flex: 0 1 auto; @@ -25,29 +24,45 @@ const Card = styled.article` justify-content: flex-end; min-height: 5.7rem; padding: 0.5rem 1.5rem; - text-align: left; > div { - font-size: 2.2rem; + font-size: 2.1rem; font-weight: 100; - line-height: 2.25rem; + line-height: 2.1rem; text-align: right; > * { - margin: 0.4rem 0; + margin: 0.6rem 0; + + &:first-child { + margin-top: 0; + } + + &:last-child { + margin-bottom: 0; + } } > label { line-height: 1rem; - min-width: 7rem !important; - font-size: 0.9rem; + font-size: 0.95rem; } .progress { - margin: 0.25rem 0 -0.5rem !important; + margin: 0.2rem 0 -0.5rem !important; background: rgba(0,0,0,0.05); } } + + @media(max-width: 767px) { + min-height: 4.8rem; + padding: 0.25 0.4em; + + > div { + font-size: 1.4rem; + line-height: 1.4rem; + } + } `; type ProgressProps = { @@ -66,7 +81,7 @@ type Props = BareProps & { export default class CardSummary extends React.PureComponent { render () { - const { children, progress, label } = this.props; + const { children, className, label, progress, style } = this.props; const value = progress && progress.value; const total = progress && progress.total; const left = progress && !isUndefined(value) && !isUndefined(total) && value.gten(0) && total.gtn(0) @@ -90,7 +105,10 @@ export default class CardSummary extends React.PureComponent { } return ( - + section { display: flex; @@ -41,10 +25,6 @@ const StyledSummary = styled.div` text-align: left; } - > section:first-child > article:first-child .label-small > label { - min-width: 4rem !important; - } - details & { display: block; margin: 0.5rem 0.25rem; @@ -61,6 +41,14 @@ const StyledSummary = styled.div` } } + @media(max-width: 767px) { + padding: 0; + + .ui--media-small { + display: none !important; + } + } + .ui.label { padding-left: 0; padding-right: 0; diff --git a/packages/ui-app/src/styles/app.css b/packages/ui-app/src/styles/app.css index 65e7d41379..220fed2143 100644 --- a/packages/ui-app/src/styles/app.css +++ b/packages/ui-app/src/styles/app.css @@ -53,7 +53,6 @@ br { } main { - padding: 1em 2em; min-height: 100vh; } @@ -98,6 +97,10 @@ article { } header { - margin-bottom: 2em; + margin-bottom: 1.1rem; text-align: center; + + @media(max-width: 767px) { + margin-bottom: 0.8rem; + } } diff --git a/packages/ui-app/src/styles/media.css b/packages/ui-app/src/styles/media.css index 11f04983dc..326525b09a 100644 --- a/packages/ui-app/src/styles/media.css +++ b/packages/ui-app/src/styles/media.css @@ -13,6 +13,7 @@ .ui--media-large, .ui--media-medium, .ui--media-small { + display: none; height: 0; visibility: hidden; width: 0; @@ -70,6 +71,7 @@ th.ui--media-small { height: auto; visibility: visible; width: auto; + } td.ui--media-small, @@ -81,7 +83,7 @@ th.ui--media-small { /* tabs */ @media (max-width: 767px) { .ui.menu.tabular { - padding-left: 4.2rem !important; + padding-left: 5.2rem !important; } } diff --git a/packages/ui-app/src/styles/semantic.css b/packages/ui-app/src/styles/semantic.css index 395f2ddb8f..cd9da59c0b 100644 --- a/packages/ui-app/src/styles/semantic.css +++ b/packages/ui-app/src/styles/semantic.css @@ -160,14 +160,27 @@ } .ui.menu.tabular { - background: #f2f2f2; + border-color: #e6e6e6; /* break out of the wrapping main padding */ margin: -1em -2em 0; - padding: 1em 2em 0; + overflow-x: scroll; + padding: 2em 2em 0 2em; transition: padding-left 0.2s linear 0.4s; - .item.active { - background: #fafafa /* #fff */; + &::-webkit-scrollbar { + display: none; + width: 0px; + } + + .item { + border-bottom: 2px solid rgba(0, 0, 0, 0); + top: -1px; + + &.active { + background: none; /* #fafafa */; + border: none; + border-bottom: 2px solid #3f3f3f; + } } } diff --git a/packages/ui-app/src/styles/theme/polkadot.css b/packages/ui-app/src/styles/theme/polkadot.css index 9e841a80c5..3d9afb0914 100644 --- a/packages/ui-app/src/styles/theme/polkadot.css +++ b/packages/ui-app/src/styles/theme/polkadot.css @@ -114,4 +114,8 @@ color: $nav-link; } } + + .ui.menu.tabular .item.active { + border-bottom: 2px solid rgba(215, 94, 161, 1); + } }