mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 07:41:38 +02:00
✨ Add a default appearance to context notifications
This commit is contained in:
parent
e5bccc470b
commit
721760d679
5 changed files with 21 additions and 5 deletions
|
@ -86,6 +86,9 @@ $grayish-red: #bfbfbf;
|
||||||
--color-foreground-error: #{$red-500};
|
--color-foreground-error: #{$red-500};
|
||||||
--color-accent-info: #{$blue-500};
|
--color-accent-info: #{$blue-500};
|
||||||
--color-background-info: #{$blue-200};
|
--color-background-info: #{$blue-200};
|
||||||
|
--color-background-default: #{$white};
|
||||||
|
--color-accent-default: #{$gray-100};
|
||||||
|
--color-icon-default: #{$blue-teal-700};
|
||||||
|
|
||||||
--color-background-primary: #{$white};
|
--color-background-primary: #{$white};
|
||||||
--color-background-secondary: #{$gray-200};
|
--color-background-secondary: #{$gray-200};
|
||||||
|
@ -124,6 +127,9 @@ $grayish-red: #bfbfbf;
|
||||||
--color-foreground-error: #{$red-500};
|
--color-foreground-error: #{$red-500};
|
||||||
--color-accent-info: #{$blue-500};
|
--color-accent-info: #{$blue-500};
|
||||||
--color-background-info: #{$blue-950};
|
--color-background-info: #{$blue-950};
|
||||||
|
--color-background-default: #{$gray-950};
|
||||||
|
--color-accent-default: #{$gray-800};
|
||||||
|
--color-icon-default: #{$grayish-blue-500};
|
||||||
|
|
||||||
--color-background-primary: #{$gray-950};
|
--color-background-primary: #{$gray-950};
|
||||||
--color-background-secondary: #{$black};
|
--color-background-secondary: #{$black};
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default {
|
||||||
control: { type: "select" },
|
control: { type: "select" },
|
||||||
},
|
},
|
||||||
level: {
|
level: {
|
||||||
options: ["info", "error", "warning", "success"],
|
options: ["default", "info", "error", "warning", "success"],
|
||||||
control: { type: "select" },
|
control: { type: "select" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -30,7 +30,7 @@ export default {
|
||||||
isHtml: false,
|
isHtml: false,
|
||||||
type: "context",
|
type: "context",
|
||||||
appearance: "neutral",
|
appearance: "neutral",
|
||||||
level: "info",
|
level: "default",
|
||||||
},
|
},
|
||||||
parameters: {
|
parameters: {
|
||||||
controls: {
|
controls: {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
[:class {:optional true} :string]
|
[:class {:optional true} :string]
|
||||||
[:type {:optional true} [:maybe [:enum :toast :context]]]
|
[:type {:optional true} [:maybe [:enum :toast :context]]]
|
||||||
[:appearance {:optional true} [:enum :neutral :ghost]]
|
[:appearance {:optional true} [:enum :neutral :ghost]]
|
||||||
[:level {:optional true} [:maybe [:enum :info :warning :error :success]]]
|
[:level {:optional true} [:maybe [:enum :default :info :warning :error :success]]]
|
||||||
[:is-html {:optional true} :boolean]])
|
[:is-html {:optional true} :boolean]])
|
||||||
|
|
||||||
(mf/defc context-notification*
|
(mf/defc context-notification*
|
||||||
|
@ -28,13 +28,14 @@
|
||||||
[{:keys [class type appearance level is-html children] :rest props}]
|
[{:keys [class type appearance level is-html children] :rest props}]
|
||||||
(let [class (dm/str class " " (stl/css-case :contextual-notification true
|
(let [class (dm/str class " " (stl/css-case :contextual-notification true
|
||||||
:contain-html is-html
|
:contain-html is-html
|
||||||
|
:level-default (= level :default)
|
||||||
:level-warning (= level :warning)
|
:level-warning (= level :warning)
|
||||||
:level-error (= level :error)
|
:level-error (= level :error)
|
||||||
:level-success (= level :success)
|
:level-success (= level :success)
|
||||||
:level-info (= level :info)))
|
:level-info (= level :info)))
|
||||||
level (if (string? level)
|
level (if (string? level)
|
||||||
(keyword level)
|
(keyword level)
|
||||||
(d/nilv level :info))
|
(d/nilv level :default))
|
||||||
type (if (string? type)
|
type (if (string? type)
|
||||||
(keyword type)
|
(keyword type)
|
||||||
(d/nilv type :context))
|
(d/nilv type :context))
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
[level]
|
[level]
|
||||||
(case level
|
(case level
|
||||||
:info i/info
|
:info i/info
|
||||||
|
:default i/msg-neutral
|
||||||
:warning i/msg-neutral
|
:warning i/msg-neutral
|
||||||
:error i/delete-text
|
:error i/delete-text
|
||||||
:success i/status-tick
|
:success i/status-tick
|
||||||
|
@ -22,7 +23,7 @@
|
||||||
|
|
||||||
(def ^:private schema:notification-pill
|
(def ^:private schema:notification-pill
|
||||||
[:map
|
[:map
|
||||||
[:level [:enum :info :warning :error :success]]
|
[:level [:enum :default :info :warning :error :success]]
|
||||||
[:type [:enum :toast :context]]
|
[:type [:enum :toast :context]]
|
||||||
[:appearance {:optional true} [:enum :neutral :ghost]]
|
[:appearance {:optional true} [:enum :neutral :ghost]]
|
||||||
[:is-html {:optional true} :boolean]])
|
[:is-html {:optional true} :boolean]])
|
||||||
|
@ -36,6 +37,7 @@
|
||||||
:appearance-ghost (= appearance :ghost)
|
:appearance-ghost (= appearance :ghost)
|
||||||
:type-toast (= type :toast)
|
:type-toast (= type :toast)
|
||||||
:type-context (= type :context)
|
:type-context (= type :context)
|
||||||
|
:level-default (= level :default)
|
||||||
:level-warning (= level :warning)
|
:level-warning (= level :warning)
|
||||||
:level-error (= level :error)
|
:level-error (= level :error)
|
||||||
:level-success (= level :success)
|
:level-success (= level :success)
|
||||||
|
|
|
@ -43,6 +43,13 @@
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.level-default {
|
||||||
|
--notification-bg-color: var(--color-background-default);
|
||||||
|
--notification-fg-color: var(--color-foreground-primary);
|
||||||
|
--notification-border-color: var(--color-accent-default);
|
||||||
|
--notification-icon-color: var(--color-icon-default);
|
||||||
|
}
|
||||||
|
|
||||||
.level-info {
|
.level-info {
|
||||||
--notification-bg-color: var(--color-background-info);
|
--notification-bg-color: var(--color-background-info);
|
||||||
--notification-fg-color: var(--color-foreground-primary);
|
--notification-fg-color: var(--color-foreground-primary);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue