Skip to content

Commit

Permalink
refactor(cxl-lumo-styles): cxl-section - do not target #view-hero
Browse files Browse the repository at this point in the history
  • Loading branch information
freudFlintstone committed Dec 4, 2023
1 parent a19be96 commit 4cd9514
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
5 changes: 3 additions & 2 deletions packages/cxl-lumo-styles/scss/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
position: relative;
overflow-x: hidden;
background-repeat: no-repeat !important;
background-size: auto clamp(65%, 40vw, 90%) !important;
background-size: auto clamp(22%, 20vw, 90%) !important;
background-position: left calc(50vw + clamp(48px, 5%, 100px)) bottom calc(25% + var(--figure-height-factor)) !important;

&::before {
position: absolute;
Expand Down Expand Up @@ -99,7 +100,7 @@
width: 100%;
height: clamp(calc(50% + 82px), calc(50% + var(--figure-height-factor)), calc(50% + var(--figure-height-factor)));
max-height: calc(50% + var(--figure-height-factor));
background-image: var(--hero-image);
background-image: var(--cxl-hero-image);
background-repeat: no-repeat !important;
background-size: auto clamp(65%, 40vw, 100%) !important;
background-position-x: left !important;
Expand Down
3 changes: 1 addition & 2 deletions packages/cxl-ui/scss/cxl-section.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@
background-color: transparent !important; /* stylelint-disable-line declaration-no-important */
}

@media #{mq.$large} {
@media #{mq.$medium} {
:host(#view-hero) {
@include mixins.wide-background();
@include mixins.extend-background-right();
@include mixins.wide-background-hero();
@include mixins.wide-background-hero-image();
}

:host([theme~="cxl-hero"]) {
Expand Down
6 changes: 3 additions & 3 deletions packages/cxl-ui/scss/global/cxl-section.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@


// Use more specific selector to hide cxl-section background-image.
cxl-section.wp-block-group.wp-block-cxl-section#view-hero {
cxl-section.wp-block-group.wp-block-cxl-section[theme~="cxl-hero"] {
background: none !important;
}

cxl-section#view-hero, cxl-section[theme~="cxl-header"] {
cxl-section#view-hero, cxl-section[theme~="cxl-hero"] {
.column-1 {
@media #{mq.$large} {
@media #{mq.$medium} {
max-width: 45%;
}
}
Expand Down
6 changes: 2 additions & 4 deletions packages/storybook/cxl-ui/cxl-section/cxl-section.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ export default {
description: {
component: 'Use `<cxl-section theme="cxl-header">` to create a section header component. \
`cxl-section` components with id="view-hero" are automatically themed as hero headers. \
Additionally, it is necessary to add CSS code in wordpress block-editor: \
Additionally, it is necessary to add inline CSS code on cxl-section element: \
\
\
`#view-hero::after { \
background-image: url([wpv-post-featured-image size="xx-large" output="url"]); \
}` \
`style="--hero-image: url([wpv-post-featured-image size="large" output="url"])"` \
',
},
}
Expand Down

0 comments on commit 4cd9514

Please sign in to comment.