Skip to content

Commit

Permalink
feat(banner): Add Theming API support for max width and z-index
Browse files Browse the repository at this point in the history
New tokens:

* `content-max-width`
* `z-index`

PiperOrigin-RevId: 605349697
  • Loading branch information
kvizcarra authored and Copybara-Service committed Feb 8, 2024
1 parent a0b8a90 commit e50b478
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 8 additions & 3 deletions packages/mdc-banner/_banner-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ $primary-action-text-color: primary;
$secondary-action-text-color: primary;

$mobile-breakpoint: 480px;
$z-index: 1;
$custom-property-prefix: 'banner';

$light-theme: (
Expand All @@ -70,6 +69,7 @@ $light-theme: (
container-elevation: null,
container-shadow-color: null,
container-shape: 0,
content-max-width: 720px,
divider-color: $divider-color,
divider-height: 1px,
supporting-text-color: theme-color.$on-surface,
Expand All @@ -82,6 +82,7 @@ $light-theme: (
with-image-image-size: 40px,
with-image-image-color: $graphic-color,
with-image-image-container-color: $graphic-background-color,
z-index: 1,
);

@mixin theme($theme, $resolvers: resolvers.$material) {
Expand Down Expand Up @@ -136,6 +137,10 @@ $light-theme: (
$prefix: $custom-property-prefix
);

@include z-index(map.get($theme, 'z-index'), $query: $query);

@include max-width(map.get($theme, 'content-max-width'), $query: $query);

@include graphic-color(
map.get($theme, 'with-image-image-color'),
$query: $query
Expand Down Expand Up @@ -348,7 +353,7 @@ $light-theme: (

.mdc-banner__content {
@include feature-targeting.targets($feat-structure) {
max-width: $max-width;
@include theme.property(max-width, $max-width);
}
}
}
Expand Down Expand Up @@ -401,7 +406,7 @@ $light-theme: (
$feat-structure: feature-targeting.create-target($query, structure);

@include feature-targeting.targets($feat-structure) {
z-index: $z-index;
@include theme.property(z-index, $z-index);
}
}

Expand Down
4 changes: 0 additions & 4 deletions packages/mdc-banner/_banner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

$_text-type-scale: body2;
$_min-width: 344px;
$_max-width: 720px;
// Minimum banner height minus standard text height, divided by 2 for both top
// and bottom padding. This is used to support two/three line banners.
$_text-padding-top-bottom: math.div(52px - 20px, 2);
Expand All @@ -48,7 +47,6 @@ $_exit-duration: 250ms;
$feat-animation: feature-targeting.create-target($query, animation);

@include banner-theme.min-width($_min-width, $query: $query);
@include banner-theme.max-width($_max-width, $query: $query);
@include static-styles($query: $query);

.mdc-banner {
Expand All @@ -70,8 +68,6 @@ $_exit-duration: 250ms;
$feat-animation: feature-targeting.create-target($query, animation);

.mdc-banner {
@include banner-theme.z-index(banner-theme.$z-index, $query: $query);

@include feature-targeting.targets($feat-structure) {
// Mobile view styles.
@media (max-width: banner-theme.$mobile-breakpoint) {
Expand Down

0 comments on commit e50b478

Please sign in to comment.