Skip to content

Commit

Permalink
Update menu and message
Browse files Browse the repository at this point in the history
  • Loading branch information
jgthms committed Sep 18, 2024
1 parent 04d8632 commit 23feb10
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 128 deletions.
121 changes: 56 additions & 65 deletions sass/components/menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,33 @@
@use "../utilities/extends";
@use "../utilities/mixins" as mx;

$menu-item-h: cv.getVar("scheme-h");
$menu-item-s: cv.getVar("scheme-s");
$menu-item-l: cv.getVar("scheme-main-l");
$menu-item-background-l: cv.getVar("scheme-main-l");
$menu-item-background-l-delta: 0%;
$menu-item-hover-background-l-delta: cv.getVar("hover-background-l-delta");
$menu-item-active-background-l-delta: cv.getVar("active-background-l-delta");
$menu-item-color-l: cv.getVar("text-l");
$menu-item-background-color: cv.getVar("scheme-main") !default;
$menu-item-color: cv.getVar("text") !default;
$menu-item-hover-background-color: hsl(
from #{cv.getVar("menu-item-background-color")} h s calc(l + #{cv.getVar(
"hover-background-l-delta"
)})
) !default;
$menu-item-hover-color: cv.getVar("text-strong") !default;
$menu-item-active-background-color: hsl(
from #{cv.getVar("menu-item-background-color")} h s calc(l + #{cv.getVar(
"active-background-l-delta"
)})
) !default;
$menu-item-active-color: cv.getVar("text-strong") !default;
$menu-item-selected-background-color: cv.getVar("link") !default;
$menu-item-selected-color: cv.getVar("link-invert") !default;
$menu-item-selected-hover-background-color: hsl(
from #{cv.getVar("menu-item-selected-background-color")} h s calc(l + #{cv.getVar(
"hover-background-l-delta"
)})
) !default;
$menu-item-selected-active-background-color: hsl(
from #{cv.getVar("menu-item-selected-background-color")} h s calc(l + #{cv.getVar(
"active-background-l-delta"
)})
) !default;
$menu-item-radius: cv.getVar("radius-small") !default;
$menu-item-selected-h: cv.getVar("link-h");
$menu-item-selected-s: cv.getVar("link-s");
$menu-item-selected-l: cv.getVar("link-l");
$menu-item-selected-background-l: cv.getVar("link-l");
$menu-item-selected-color-l: cv.getVar("link-invert-l");

$menu-list-border-left: 1px solid cv.getVar("border") !default;
$menu-list-line-height: 1.25 !default;
Expand All @@ -32,20 +45,17 @@ $menu-label-spacing: 1em !default;
.#{iv.$class-prefix}menu {
@include cv.register-vars(
(
"menu-item-h": #{$menu-item-h},
"menu-item-s": #{$menu-item-s},
"menu-item-l": #{$menu-item-l},
"menu-item-background-l": #{$menu-item-background-l},
"menu-item-background-l-delta": #{$menu-item-background-l-delta},
"menu-item-hover-background-l-delta": #{$menu-item-hover-background-l-delta},
"menu-item-active-background-l-delta": #{$menu-item-active-background-l-delta},
"menu-item-color-l": #{$menu-item-color-l},
"menu-item-background-color": #{$menu-item-background-color},
"menu-item-color": #{$menu-item-color},
"menu-item-hover-background-color": #{$menu-item-hover-background-color},
"menu-item-hover-color": #{$menu-item-hover-color},
"menu-item-active-background-color": #{$menu-item-active-background-color},
"menu-item-active-color": #{$menu-item-active-color},
"menu-item-selected-background-color": #{$menu-item-selected-background-color},
"menu-item-selected-color": #{$menu-item-selected-color},
"menu-item-selected-hover-background-color": #{$menu-item-selected-hover-background-color},
"menu-item-selected-active-background-color": #{$menu-item-selected-active-background-color},
"menu-item-radius": #{$menu-item-radius},
"menu-item-selected-h": #{$menu-item-selected-h},
"menu-item-selected-s": #{$menu-item-selected-s},
"menu-item-selected-l": #{$menu-item-selected-l},
"menu-item-selected-background-l": #{$menu-item-selected-background-l},
"menu-item-selected-color-l": #{$menu-item-selected-color-l},
"menu-list-border-left": #{$menu-list-border-left},
"menu-list-line-height": #{$menu-list-line-height},
"menu-list-link-padding": #{$menu-list-link-padding},
Expand Down Expand Up @@ -83,60 +93,41 @@ $menu-label-spacing: 1em !default;
button,
.#{iv.$class-prefix}menu-item {
@extend %reset;
background-color: hsl(
#{cv.getVar("menu-item-h")},
#{cv.getVar("menu-item-s")},
calc(
#{cv.getVar("menu-item-background-l")} + #{cv.getVar(
"menu-item-background-l-delta"
)}
)
);
background-color: cv.getVar("menu-item-background-color");
border-radius: cv.getVar("menu-item-radius");
color: hsl(
#{cv.getVar("menu-item-h")},
#{cv.getVar("menu-item-s")},
#{cv.getVar("menu-item-color-l")}
);
color: cv.getVar("menu-item-color");
display: block;
padding: cv.getVar("menu-list-link-padding");
text-align: left;
width: 100%;

&:hover {
@include cv.register-vars(
(
"menu-item-background-l-delta": #{cv.getVar(
"menu-item-hover-background-l-delta"
)},
)
);
background-color: cv.getVar("menu-item-hover-background-color");
color: cv.getVar("menu-item-hover-color");
}

&:active {
@include cv.register-vars(
(
"menu-item-background-l-delta": #{cv.getVar(
"menu-item-active-background-l-delta"
)},
)
);
background-color: cv.getVar("menu-item-active-background-color");
color: cv.getVar("menu-item-active-color");
}

// Modifiers
&.#{iv.$class-prefix}is-active,
&.#{iv.$class-prefix}is-selected {
@include cv.register-vars(
(
"menu-item-h": #{cv.getVar("menu-item-selected-h")},
"menu-item-s": #{cv.getVar("menu-item-selected-s")},
"menu-item-l": #{cv.getVar("menu-item-selected-l")},
"menu-item-background-l": #{cv.getVar(
"menu-item-selected-background-l"
)},
"menu-item-color-l": #{cv.getVar("menu-item-selected-color-l")},
)
);
background-color: cv.getVar("menu-item-selected-background-color");
color: cv.getVar("menu-item-selected-color");

&:hover {
background-color: cv.getVar(
"menu-item-selected-hover-background-color"
);
}

&:active {
background-color: cv.getVar(
"menu-item-selected-active-background-color"
);
}
}
}

Expand Down
97 changes: 34 additions & 63 deletions sass/components/message.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,24 @@
@use "../utilities/extends";
@use "../utilities/mixins" as mx;

$message-h: cv.getVar("scheme-h");
$message-s: cv.getVar("scheme-s");
$message-background-color: cv.getVar("background");
$message-background-l: cv.getVar("background-l");
$message-border-l: cv.getVar("border-l");
$message-border-l-delta: -20% !default;
$message-color: cv.getVar("text") !default;
$message-border-color: cv.getVar("border");
$message-border-style: solid;
$message-border-width: 0.25em;
$message-color-l: cv.getVar("text-l");
$message-header-background-l: cv.getVar("dark-l");
$message-header-color-l: cv.getVar("text-dark-invert-l");
$message-radius: cv.getVar("radius") !default;
$message-header-background-color: cv.getVar("text");
$message-header-color: cv.getVar("text-invert");
$message-radius: cv.getVar("radius-large") !default;

$message-header-weight: cv.getVar("weight-semibold") !default;
$message-header-padding: 1em 1.25em !default;
$message-header-radius: cv.getVar("radius") !default;
$message-header-radius: cv.getVar("radius-large") !default;

$message-body-border-width: 0 0 0 4px !default;
$message-body-color: cv.getVar("text") !default;
$message-body-padding: 1.25em 1.5em !default;
$message-body-radius: cv.getVar("radius-small") !default;
$message-body-radius: cv.getVar("radius-medium") !default;

$message-body-pre-code-background-color: transparent !default;

Expand All @@ -33,7 +31,10 @@ $message-colors: dv.$colors !default;
.#{iv.$class-prefix}message {
@include cv.register-vars(
(
"message-border-l-delta": #{$message-border-l-delta},
"message-background-color": #{$message-background-color},
"message-background-l": #{$message-background-l},
"message-color": #{$message-color},
"message-border-color": #{$message-border-color},
"message-radius": #{$message-radius},
"message-header-weight": #{$message-header-weight},
"message-header-padding": #{$message-header-padding},
Expand All @@ -44,27 +45,18 @@ $message-colors: dv.$colors !default;
"message-body-radius": #{$message-body-radius},
"message-body-pre-code-background-color": #{$message-body-pre-code-background-color},
"message-header-body-border-width": #{$message-header-body-border-width},
"message-h": #{$message-h},
"message-s": #{$message-s},
"message-background-l": #{$message-background-l},
"message-border-l": #{$message-border-l},
"message-border-style": #{$message-border-style},
"message-border-width": #{$message-border-width},
"message-color-l": #{$message-color-l},
"message-header-background-l": #{$message-header-background-l},
"message-header-color-l": #{$message-header-color-l},
"message-header-background-color": #{$message-header-background-color},
"message-header-color": #{$message-header-color},
)
);
}

.#{iv.$class-prefix}message {
@extend %block;
border-radius: cv.getVar("message-radius");
color: hsl(
#{cv.getVar("message-h")},
#{cv.getVar("message-s")},
#{cv.getVar("message-color-l")}
);
color: cv.getVar("message-color");
font-size: cv.getVar("size-normal");

strong {
Expand Down Expand Up @@ -96,17 +88,11 @@ $message-colors: dv.$colors !default;
&.#{iv.$class-prefix}is-#{$name} {
@include cv.register-vars(
(
"message-h": #{cv.getVar($name, "", "-h")},
"message-s": #{cv.getVar($name, "", "-s")},
"message-border-l":
calc(
#{cv.getVar($name, "", "-l")} + #{cv.getVar(
"message-border-l-delta"
)}
),
"message-color-l": #{cv.getVar($name, "", "-on-scheme-l")},
"message-header-background-l": #{cv.getVar($name, "", "-l")},
"message-header-color-l": #{cv.getVar($name, "", "-invert-l")},
"message-background-color": #{cv.getVar($name, "", "-light")},
"message-border-color": #{cv.getVar($name)},
"message-color": #{cv.getVar($name, "", "-on-scheme")},
"message-header-background-color": #{cv.getVar($name)},
"message-header-color": #{cv.getVar($name, "", "-invert")},
)
);
}
Expand All @@ -115,18 +101,10 @@ $message-colors: dv.$colors !default;

.#{iv.$class-prefix}message-header {
align-items: center;
background-color: hsl(
#{cv.getVar("message-h")},
#{cv.getVar("message-s")},
#{cv.getVar("message-header-background-l")}
);
background-color: cv.getVar("message-header-background-color");
border-start-start-radius: cv.getVar("message-header-radius");
border-start-end-radius: cv.getVar("message-header-radius");
color: hsl(
#{cv.getVar("message-h")},
#{cv.getVar("message-s")},
#{cv.getVar("message-header-color-l")}
);
color: cv.getVar("message-header-color");
display: flex;
font-weight: cv.getVar("message-header-weight");
justify-content: space-between;
Expand All @@ -144,37 +122,30 @@ $message-colors: dv.$colors !default;
border-width: cv.getVar("message-header-body-border-width");
border-start-start-radius: 0;
border-start-end-radius: 0;
border-end-end-radius: cv.getVar("message-radius");
border-end-start-radius: cv.getVar("message-radius");
}
}

.#{iv.$class-prefix}message-body {
background-color: hsl(
#{cv.getVar("message-h")},
#{cv.getVar("message-s")},
#{cv.getVar("message-background-l")}
);
border-inline-start-color: hsl(
#{cv.getVar("message-h")},
#{cv.getVar("message-s")},
#{cv.getVar("message-border-l")}
from #{cv.getVar("message-background-color")} h s #{cv.getVar(
"message-background-l"
)}
);
border-inline-start-color: cv.getVar("message-border-color");
border-inline-start-style: #{cv.getVar("message-border-style")};
border-inline-start-width: #{cv.getVar("message-border-width")};
border-radius: cv.getVar("message-body-radius");
border-start-start-radius: 0;
border-start-end-radius: cv.getVar("message-radius");
border-end-end-radius: cv.getVar("message-radius");
border-end-start-radius: 0;
padding: cv.getVar("message-body-padding");

code,
pre {
background-color: hsl(
#{cv.getVar("message-h")},
#{cv.getVar("message-s")},
#{cv.getVar("message-header-color-l")}
);
color: hsl(
#{cv.getVar("message-h")},
#{cv.getVar("message-s")},
#{cv.getVar("message-header-background-l")}
);
background-color: cv.getVar("message-header-color");
color: cv.getVar("message-header-background-color");
}

pre code {
Expand Down

0 comments on commit 23feb10

Please sign in to comment.