From 4128a404b3419b31eb5f31729448d10ca3f2e08c Mon Sep 17 00:00:00 2001 From: Pavel Laptev Date: Thu, 7 Mar 2024 14:38:29 +0100 Subject: [PATCH] Info message updates - added new `success` style - added two propes `filled` and `outlined` with which you can modify the look and switch on or off these props separatly --- .../src/lib/components/InfoMessage.svelte | 67 +++++++++++++++---- gitbutler-ui/src/styles/tokens.css | 10 +-- 2 files changed, 60 insertions(+), 17 deletions(-) diff --git a/gitbutler-ui/src/lib/components/InfoMessage.svelte b/gitbutler-ui/src/lib/components/InfoMessage.svelte index 5690df67c..08af1fda2 100644 --- a/gitbutler-ui/src/lib/components/InfoMessage.svelte +++ b/gitbutler-ui/src/lib/components/InfoMessage.svelte @@ -1,5 +1,5 @@ @@ -44,6 +49,9 @@ class:error={style == 'error'} class:pop={style == 'pop'} class:warn={style == 'warn'} + class:success={style == 'success'} + class:has-border={outlined} + class:has-background={filled} class:shadow > @@ -78,6 +86,7 @@ padding: var(--space-16); border-radius: var(--radius-m); gap: var(--space-12); + background-color: var(--clr-theme-container-light); } .info-message__inner { display: flex; @@ -96,26 +105,60 @@ gap: var(--space-6); justify-content: flex-end; } + .info-message__text { + &:empty { + display: none; + } + } + + /* MODIFIERS */ .neutral { - background-color: var(--clr-theme-container-light); - border: 1px solid var(--clr-theme-container-outline-light); + border: 0 solid var(--clr-theme-container-outline-light); } .error { - background-color: var(--clr-theme-container-light); - border: 1px solid var(--clr-theme-scale-err-60); + border: 0 solid var(--clr-theme-scale-err-60); } .pop { - background-color: var(--clr-theme-container-light); - border: 1px solid var(--clr-theme-scale-pop-50); + border: 0 solid var(--clr-theme-scale-pop-50); } .warn { - background-color: var(--clr-theme-container-light); - border: 1px solid var(--clr-theme-scale-warn-60); + border: 0 solid var(--clr-theme-scale-warn-60); + } + .success { + border: 0 solid var(--clr-theme-scale-succ-60); } .shadow { box-shadow: 0px 7px 14px 0px rgba(0, 0, 0, 0.1); } + /* OUTLINED */ + + .has-border { + border-width: 1px; + } + + .has-background { + &.neutral { + background-color: var(--clr-theme-container-pale); + } + + &.error { + background-color: var(--clr-theme-err-container); + } + + &.pop { + background-color: var(--clr-theme-pop-container); + } + + &.warn { + background-color: var(--clr-theme-warn-container); + } + + &.success { + background-color: var(--clr-theme-succ-container); + } + } + /* rendered markdown requires global */ :global(.info-message__text a) { cursor: pointer; diff --git a/gitbutler-ui/src/styles/tokens.css b/gitbutler-ui/src/styles/tokens.css index 94db9a0f7..c866b8682 100644 --- a/gitbutler-ui/src/styles/tokens.css +++ b/gitbutler-ui/src/styles/tokens.css @@ -79,17 +79,17 @@ --clr-theme-container-outline-sub: var(--clr-core-ntrl-50); --clr-theme-container-pale: var(--clr-core-ntrl-90); --clr-theme-container-sub: var(--clr-core-ntrl-80); - --clr-theme-err-container: var(--clr-core-err-95); + --clr-theme-err-container: var(--clr-core-err-90); --clr-theme-err-element: var(--clr-core-err-50); --clr-theme-err-on-container: var(--clr-core-err-40); --clr-theme-err-on-element: var(--clr-core-err-90); --clr-theme-err-outline: var(--clr-core-err-50); - --clr-theme-pop-container: var(--clr-core-pop-95); + --clr-theme-pop-container: var(--clr-core-pop-90); --clr-theme-pop-element: var(--clr-core-pop-50); --clr-theme-pop-on-container: var(--clr-core-pop-10); --clr-theme-pop-on-element: var(--clr-core-ntrl-100); --clr-theme-pop-outline: var(--clr-core-pop-40); - --clr-theme-purple-container: var(--clr-core-purple-95); + --clr-theme-purple-container: var(--clr-core-purple-90); --clr-theme-purple-element: var(--clr-core-purple-50); --clr-theme-purple-on-container: var(--clr-core-purple-40); --clr-theme-purple-on-element: var(--clr-core-purple-90); @@ -150,12 +150,12 @@ --clr-theme-scale-warn-70: var(--clr-core-warn-70); --clr-theme-scale-warn-80: var(--clr-core-warn-80); --clr-theme-scale-warn-90: var(--clr-core-warn-90); - --clr-theme-succ-container: var(--clr-core-succ-95); + --clr-theme-succ-container: var(--clr-core-succ-90); --clr-theme-succ-element: var(--clr-core-succ-50); --clr-theme-succ-on-container: var(--clr-core-succ-40); --clr-theme-succ-on-element: var(--clr-core-succ-90); --clr-theme-succ-outline: var(--clr-core-succ-40); - --clr-theme-warn-container: var(--clr-core-warn-95); + --clr-theme-warn-container: var(--clr-core-warn-90); --clr-theme-warn-element: var(--clr-core-warn-50); --clr-theme-warn-on-container: var(--clr-core-warn-40); --clr-theme-warn-on-element: var(--clr-core-warn-90);