From b330b809450040e73f0a92a3772a4a97537c0071 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Thu, 12 Dec 2019 09:25:39 +0000 Subject: [PATCH] ui: Use base fonts throughout the app (#6881) We've had a set of %placeholders in our base styles for quite a while but not butten the bullet to use them. This begins to use them. We had to make a small amount of tweaks to base whilst doing this, but its as we'd prefer there to be as few font placeholders as possible. We might/should be able to reduce these further at somepoint, or potentially rename them. We currently have six header fonts (or 4 header fonts/2 strong body fonts) and 3 body fonts. We also noticed an empty CSS file and deleted that while we were here. We also noticed that the bottom border of structure tabs was a pixel larger than ours so we tweaked that here also. --- ui-v2/app/styles/app.scss | 3 +- .../base/components/buttons/layout.scss | 10 +- .../styles/base/components/pill/layout.scss | 5 +- .../app/styles/base/components/tabs/skin.scss | 3 +- .../base/components/tooltip/layout.scss | 3 - .../styles/base/components/tooltip/skin.scss | 1 - ui-v2/app/styles/base/reset/index.scss | 3 + .../base/typography/base-placeholders.scss | 16 +- ui-v2/app/styles/components/app-view.scss | 3 + .../styles/components/app-view/layout.scss | 2 +- .../confirmation-dialog/layout.scss | 5 +- ui-v2/app/styles/core/layout.scss | 5 +- ui-v2/app/styles/core/typography.scss | 164 +++++++----------- ui-v2/app/styles/routes/dc/acls/index.scss | 2 +- .../styles/routes/dc/acls/policies/index.scss | 0 15 files changed, 101 insertions(+), 124 deletions(-) delete mode 100644 ui-v2/app/styles/routes/dc/acls/policies/index.scss diff --git a/ui-v2/app/styles/app.scss b/ui-v2/app/styles/app.scss index e0d0d9803727..a7ee633928bf 100644 --- a/ui-v2/app/styles/app.scss +++ b/ui-v2/app/styles/app.scss @@ -1,7 +1,7 @@ @charset 'utf-8'; -@import 'base/index'; @import 'base/reset/index'; +@import 'base/index'; @import 'variables/index'; /*TODO: Move this to its own local component*/ @@ -23,4 +23,3 @@ @import 'routes/dc/kv/index'; @import 'routes/dc/acls/index'; @import 'routes/dc/acls/tokens/index'; -@import 'routes/dc/acls/policies/index'; diff --git a/ui-v2/app/styles/base/components/buttons/layout.scss b/ui-v2/app/styles/base/components/buttons/layout.scss index 08cb2c403256..421d0950d1c3 100644 --- a/ui-v2/app/styles/base/components/buttons/layout.scss +++ b/ui-v2/app/styles/base/components/buttons/layout.scss @@ -24,19 +24,15 @@ text-align: center; justify-content: center; align-items: center; - padding: calc(0.375em - 1px) calc(2.2em - 1px); - height: 2.55em; + padding: calc(0.5em - 1px) calc(2.2em - 1px); min-width: 100px; } %button:not(:last-child) { margin-right: 8px; } %button-compact { - /* @extend %button;*/ - padding-left: calc(1.6em - 1px) !important; - padding-right: calc(1.6em - 1px) !important; - padding-top: calc(0.35em - 1px) !important; - height: 2.3em !important; + padding-top: calc(0.4em - 1px) !important; + padding-bottom: calc(0.4em - 1px) !important; } %internal-button { padding: 0.75rem 1rem; diff --git a/ui-v2/app/styles/base/components/pill/layout.scss b/ui-v2/app/styles/base/components/pill/layout.scss index 95b1e132ea81..1f29e0b4c110 100644 --- a/ui-v2/app/styles/base/components/pill/layout.scss +++ b/ui-v2/app/styles/base/components/pill/layout.scss @@ -6,7 +6,8 @@ } %pill button { padding: 0; - height: 10px; - margin-right: 3px; + width: 9px; + height: 9px; + margin-right: 4px; font-size: 0; } diff --git a/ui-v2/app/styles/base/components/tabs/skin.scss b/ui-v2/app/styles/base/components/tabs/skin.scss index 1f98e6918867..4bbe754daff2 100644 --- a/ui-v2/app/styles/base/components/tabs/skin.scss +++ b/ui-v2/app/styles/base/components/tabs/skin.scss @@ -1,6 +1,7 @@ %tab-nav { /* %frame-gray-something */ border-bottom: $decor-border-100; + /* TODO: structure tabs don't actually have a top border */ border-top: $decor-border-200; } %tab-nav { @@ -18,7 +19,7 @@ text-decoration: none; } %tab-button { - border-bottom: $decor-border-200; + border-bottom: $decor-border-300; } %tab-button { border-color: $color-transparent; diff --git a/ui-v2/app/styles/base/components/tooltip/layout.scss b/ui-v2/app/styles/base/components/tooltip/layout.scss index 042e026ae2ed..55a6d459d323 100644 --- a/ui-v2/app/styles/base/components/tooltip/layout.scss +++ b/ui-v2/app/styles/base/components/tooltip/layout.scss @@ -15,9 +15,6 @@ white-space: nowrap; content: attr(data-tooltip); text-indent: 0; - /* TODO: should this be hardcoded here ? */ - font-size: 14px; - /* structure */ min-width: 192px; } %tooltip-bubble { diff --git a/ui-v2/app/styles/base/components/tooltip/skin.scss b/ui-v2/app/styles/base/components/tooltip/skin.scss index 6663e84b2d01..493fb4a51ac1 100644 --- a/ui-v2/app/styles/base/components/tooltip/skin.scss +++ b/ui-v2/app/styles/base/components/tooltip/skin.scss @@ -19,7 +19,6 @@ border-bottom: 18px solid $gray-500; } %tooltip-bubble { - font-weight: normal; border-radius: $decor-radius-200; /* this isn't quite like the values in structure */ /* but this looks closer visually */ diff --git a/ui-v2/app/styles/base/reset/index.scss b/ui-v2/app/styles/base/reset/index.scss index 0aec96d2de6c..8a7dce89c3b4 100644 --- a/ui-v2/app/styles/base/reset/index.scss +++ b/ui-v2/app/styles/base/reset/index.scss @@ -1,3 +1,6 @@ @import './base-variables'; +@import '../color/base-variables'; +@import '../color/semantic-variables'; +@import '../typography/base-variables'; @import './system'; @import './minireset'; diff --git a/ui-v2/app/styles/base/typography/base-placeholders.scss b/ui-v2/app/styles/base/typography/base-placeholders.scss index f153f07b4c3f..c0936bf585fc 100644 --- a/ui-v2/app/styles/base/typography/base-placeholders.scss +++ b/ui-v2/app/styles/base/typography/base-placeholders.scss @@ -18,9 +18,14 @@ font-weight: $typo-weight-bold; } %h2, -%h3 { +%h3, +%h4 { font-weight: $typo-weight-semibold; } +%h5, +%h6 { + font-weight: $typo-weight-medium; +} %h1 { font-size: $typo-size-100; } @@ -30,6 +35,15 @@ %h3 { font-size: $typo-size-300; } +/*p1 strong, differing weights */ +%h4, +%h5 { + font-size: $typo-size-600; +} +/*p2 strong */ +%h6 { + font-size: $typo-size-700; +} %typo-p { line-height: inherit; font-size: inherit; diff --git a/ui-v2/app/styles/components/app-view.scss b/ui-v2/app/styles/components/app-view.scss index 73370bf769c5..ac73b2c80660 100644 --- a/ui-v2/app/styles/components/app-view.scss +++ b/ui-v2/app/styles/components/app-view.scss @@ -19,6 +19,9 @@ main { } } // TODO: This should be its own component +%app-view h1 { + padding-bottom: 0.2em; +} %app-view h1 span[data-tooltip] { @extend %with-external-source-icon; margin-top: 13px; diff --git a/ui-v2/app/styles/components/app-view/layout.scss b/ui-v2/app/styles/components/app-view/layout.scss index a36dbefa5f9a..f297aa6470bb 100644 --- a/ui-v2/app/styles/components/app-view/layout.scss +++ b/ui-v2/app/styles/components/app-view/layout.scss @@ -29,7 +29,7 @@ } %app-view h2 { padding-bottom: 0.2em; - margin-bottom: 0.2em; + margin-bottom: 0.5em; } %app-view-header .actions > *:not(:last-child) { margin-right: 12px; diff --git a/ui-v2/app/styles/components/confirmation-dialog/layout.scss b/ui-v2/app/styles/components/confirmation-dialog/layout.scss index 29c0cd12ac3c..017dfff8951b 100644 --- a/ui-v2/app/styles/components/confirmation-dialog/layout.scss +++ b/ui-v2/app/styles/components/confirmation-dialog/layout.scss @@ -4,12 +4,9 @@ %confirmation-dialog-inline p { margin-right: 12px; padding-left: 12px; - padding-top: 5px; - padding-bottom: 5px; - margin-bottom: 0; + margin-bottom: 0 !important; } %confirmation-dialog-inline { display: flex; align-items: center; - line-height: 1; } diff --git a/ui-v2/app/styles/core/layout.scss b/ui-v2/app/styles/core/layout.scss index 654bf1001b92..94e8bc8b1284 100644 --- a/ui-v2/app/styles/core/layout.scss +++ b/ui-v2/app/styles/core/layout.scss @@ -40,7 +40,10 @@ html.template-edit main { padding: 0; } } -/* TODO: keep margin below forms, move elsewhere */ +%main-content p:not(:last-child) { + margin-bottom: 1em; +} +/* TODO: keep margin below forms, move elsewhere? */ %main-content form, %main-content form + div .with-confirmation { margin-bottom: 2em; diff --git a/ui-v2/app/styles/core/typography.scss b/ui-v2/app/styles/core/typography.scss index 5cf3c8db47cb..56de5735c93c 100644 --- a/ui-v2/app/styles/core/typography.scss +++ b/ui-v2/app/styles/core/typography.scss @@ -1,131 +1,95 @@ -%button { - font-family: $typo-family-sans; -} -main p:not(:last-child), -%modal-window p:not(:last-child) { - margin-bottom: 1em; +body, +%form-element-textarea { + @extend %typo-body; } -%button, -%form-element textarea, -%form-element [type='text'], -%form-element [type='password'] { - line-height: 1.5; +h1 { + @extend %h1; + font-size: $typo-header-100; } -h3, -%radio-group label { - line-height: 1.25; +h2 { + @extend %h2; + font-size: $typo-header-200; } -%filter-bar [role='radiogroup'] label { - line-height: 1.7; +h3 { + @extend %h3; + font-size: $typo-header-300; } +fieldset > header, %header-nav, +%app-view-content div > dl > dt, +%table caption, +%tbody-th, +%form-element > span { + @extend %h4; +} +%internal-button, +%breadcrumbs li > *, %tab-nav { - letter-spacing: 0.03em; + @extend %h5; } -%footer { - letter-spacing: -0.05em; +%healthcheck-output dt, +%table th, +%table td strong, +%tooltip-bubble, +%sliding-toggle label span { + @extend %h6; } +pre code, +%notice, +%notice p, +%filter-bar input, +%phrase-editor input { + @extend %p1; +} +.type-dialog, +%table td p, +%table td, +%healthcheck-output dl > dd, +%form-element-label, +%stats-card header a span, +%footer, +%app-view h1 span.kind-proxy { + @extend %p2; +} +.template-error > div, %button, -%internal-button { - font-family: $typo-family-sans; +%main-content p, +%app-view > div.disabled > div, +%form-element-note, +%form-element-error > strong { + @extend %p3; } -/* Weighting */ -h1, -%app-view-content div > dt, -%header-drop-nav .is-active { - font-weight: $typo-weight-bold; + +%button { + font-weight: $typo-weight-semibold; +} + +%radio-group label { + line-height: $typo-lead-200; } -h2, -h3, -fieldset > header, -caption, %header-nav, -%healthcheck-output dt, -%copy-button, -%app-view-content div > dl > dt, -%tbody-th, -%form-element > span, -%toggle label span { - font-weight: $typo-weight-semibold; +%tab-nav { + letter-spacing: 0.03em; } -%button { - font-weight: $typo-weight-semibold !important; +%header-drop-nav .is-active { + font-weight: $typo-weight-bold; } -main label a[rel*='help'], +%main-content label a[rel*='help'], %pill, -%tbody-th em, %form-element > strong, +%tbody-th em, %app-view h1 em { font-weight: $typo-weight-normal; } -th, -td strong, -%breadcrumbs li > *, -%action-group-action, -%tab-nav, -%tooltip-bubble { - font-weight: $typo-weight-medium; -} -/* Styling */ %form-element > em, %tbody-th em, %app-view h1 em { font-style: normal; } -/* Sizing */ -%footer > * { - font-size: inherit; -} - -h1 { - font-size: $typo-header-100; -} -h2 { - font-size: $typo-header-200; -} -h3 { - font-size: $typo-header-300; -} %header-drop-nav .is-active, %app-view h1 em { font-size: $typo-size-500; } -body, -pre code, -input, -textarea, -%internal-button, -%action-group-action, -%tbody-th { - font-size: $typo-size-600; -} -th, -td, -caption, -.type-dialog, -%healthcheck-output dl > *, -%form-element > span, -%tooltip-bubble, -%stats-card header a span, -%footer, -%app-view h1 span.kind-proxy { - font-size: $typo-size-700; -} -%toggle label span { - font-size: $typo-size-700 !important; -} -fieldset > p, -.template-error > div, -[role='tabpanel'] > p:only-child, -.with-confirmation p, -%app-view-content > p:only-child, -%app-view > div.disabled > div, -%button, -%form-element > em, -%form-element > strong, -%feedback-dialog-inline p { - font-size: $typo-size-800; -} diff --git a/ui-v2/app/styles/routes/dc/acls/index.scss b/ui-v2/app/styles/routes/dc/acls/index.scss index 849ed0337e56..420091a1b5a9 100644 --- a/ui-v2/app/styles/routes/dc/acls/index.scss +++ b/ui-v2/app/styles/routes/dc/acls/index.scss @@ -10,7 +10,7 @@ td a.is-management::after { .template-policy.template-list main header .actions, .template-token.template-list main header .actions { position: relative; - top: 45px; + top: 42px; } } diff --git a/ui-v2/app/styles/routes/dc/acls/policies/index.scss b/ui-v2/app/styles/routes/dc/acls/policies/index.scss deleted file mode 100644 index e69de29bb2d1..000000000000