Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add panel is-dark, is-light, is-soft, is-bold #3876

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Bulma Changelog

## 1.0.3

### Improvements

- Add `is-dark`, `is-light`, `is-soft` and `is-bold` modifiers to the panel component

## 1.0.2

### Improvements
Expand Down
29 changes: 29 additions & 0 deletions docs/documentation/components/panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,32 @@
</article>
{% endcapture %} {% include docs/elements/snippet.html content=foobar more=true
%} {% endfor %}

<div class="content">
<p>
You can also use the <strong>dark, light, soft and bold shades</strong>.
Simply append one of the color shade modifiers.
</p>
<p>
For example, to use a darker shade of your primary color, use
<code>"is-dark"</code> as a class.
</p>
</div>

{% assign shades = "dark, light, soft, bold" | split: ", " %}
{% for variant in shades %} {% capture panel_shades %}
<article class="panel is-medium is-primary is-{{ variant }}">
<p class="panel-heading mb-0">
<span class="icon is-small">
<i class="fas fa-chevron-up" aria-hidden="true"></i>
</span>
&nbsp;&nbsp;{{ variant | capitalize }}
</p>
<div class="panel-block content is-medium">
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Molestias, quod quidem animi dignissimos incidunt magni accusantium saepe,
nobis ipsam amet facere error commodi mollitia rem ipsum in ipsa illum nesciunt!
</div>
</article>
{% endcapture %} {% include docs/elements/snippet.html content=panel_shades more=true
%} {% endfor %}
46 changes: 46 additions & 0 deletions sass/components/panel.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "sass:list";

@use "../utilities/css-variables" as cv;
@use "../utilities/initial-variables" as iv;
@use "../utilities/derived-variables" as dv;
Expand Down Expand Up @@ -33,6 +35,8 @@ $panel-block-active-icon-color: cv.getVar("link") !default;
$panel-icon-color: cv.getVar("text-weak") !default;
$panel-colors: dv.$colors !default;

$panel-no-palette: ("white", "black", "light", "dark");

.#{iv.$class-prefix}panel {
@include cv.register-vars(
(
Expand Down Expand Up @@ -93,6 +97,48 @@ $panel-colors: dv.$colors !default;
"panel-heading-color-l": #{cv.getVar($name, "", "-invert-l")},
)
);

@if not list.index($panel-no-palette, $name) {
&.#{iv.$class-prefix}is-light {
@include cv.register-vars(
(
"panel-color-l": #{cv.getVar($name, "", "-light-l")},
"panel-heading-background-l": #{cv.getVar("light-l")},
"panel-heading-color-l": #{cv.getVar($name, "", "-light-invert-l")},
)
);
}

&.#{iv.$class-prefix}is-dark {
@include cv.register-vars(
(
"panel-color-l": #{cv.getVar($name, "", "-dark-l")},
"panel-heading-background-l": #{cv.getVar("dark-l")},
"panel-heading-color-l": #{cv.getVar($name, "", "-dark-invert-l")},
)
);
}
}

&.#{iv.$class-prefix}is-soft {
@include cv.register-vars(
(
"panel-color-l": #{cv.getVar("soft-l")},
"panel-heading-background-l": #{cv.getVar("soft-l")},
"panel-heading-color-l": #{cv.getVar("soft-invert-l")},
)
);
}

&.#{iv.$class-prefix}is-bold {
@include cv.register-vars(
(
"panel-color-l": #{cv.getVar("bold-l")},
"panel-heading-background-l": #{cv.getVar("bold-l")},
"panel-heading-color-l": #{cv.getVar("bold-invert-l")},
)
);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions sass/elements/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ $button-responsive-sizes: (
),
) !default;

$no-palette: ("white", "black", "light", "dark");
$button-no-palette: ("white", "black", "light", "dark");

.#{iv.$class-prefix}button {
@include cv.register-vars(
Expand Down Expand Up @@ -331,7 +331,7 @@ $no-palette: ("white", "black", "light", "dark");
@include cv.register-var("button-border-width", 1px);
}

@if not list.index($no-palette, $name) {
@if not list.index($button-no-palette, $name) {
&.#{iv.$class-prefix}is-light {
@include cv.register-vars(
(
Expand Down