Skip to content

Commit

Permalink
feat(banner): Fixing styles for the text-overlay deprecated variant -…
Browse files Browse the repository at this point in the history
… FRONT-4618 (#3628)

* feat(banner): Fixing styles for the text-overlay deprecated variant - FRONT-4618

* fix(banner): Fixing plain background - FRONT-4618
  • Loading branch information
planctus authored Sep 16, 2024
1 parent b31d6db commit f6b93e4
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 6 deletions.
43 changes: 43 additions & 0 deletions src/implementations/twig/components/banner/banner.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const getArgs = (data) => {
vertical: 'center',
full_width: true,
gridContent: false,
oldVariants: '',
};
if (data.picture) {
args.image = data.picture.img.src || '';
Expand Down Expand Up @@ -283,6 +284,35 @@ const getArgTypes = (data) => {
type: 'boolean',
},
},
oldVariants: {
name: 'Test the old variants',
type: { name: 'select' },
description: 'Test the layout with deprecated markup',
table: {
category: 'Backward compatibility',
},
options: [
'',
'ecl-banner--plain-background',
'ecl-banner--text-box',
'ecl-banner--text-overlay',
],
mapping: {
none: '',
'plain background': 'ecl-banner--plain-background',
'text overlay': 'ecl-banner--text-overlay',
'text box': 'ecl-banner--text-box',
},
control: {
labels: {
'': 'none',
'ecl-banner--plain-background': 'plain background',
'ecl-banner--text-box': 'text box',
'ecl-banner--text-overlay': 'text overlay',
},
type: 'select',
},
},
};

if (data.picture) {
Expand Down Expand Up @@ -338,6 +368,19 @@ const prepareData = (data, args) => {
clone.picture.img.src = args.image;
}

if (args.oldVariants !== '') {
clone.extra_classes = args.oldVariants;
if (args.oldVariants === 'ecl-banner--plain-background') {
if (clone.picture) {
clone.picture.img = {};
} else {
clone.video = {};
}
}
} else {
clone.extra_classes = '';
}

return clone;
};

Expand Down
16 changes: 10 additions & 6 deletions src/implementations/vanilla/components/banner/banner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ $banner: null !default;
background: map.get($banner, 'background', 'plain-background');

.ecl-banner__info {
background: map.get($banner, 'background', 'plain-background');
background: transparent;
}

.ecl-banner__title,
Expand Down Expand Up @@ -497,13 +497,10 @@ $banner: null !default;
}

.ecl-banner__title,
.ecl-banner__title-link {
color: map.get($banner, 'text-color', 'inverted');
}

.ecl-banner__title-link,
.ecl-banner__description,
.ecl-banner__description-link {
color: map.get($banner, 'text-color', 'inverted');
color: var(--c-d);
}
}

Expand Down Expand Up @@ -535,6 +532,13 @@ $banner: null !default;
width: 100%;
}

.ecl-banner__title,
.ecl-banner__title-link,
.ecl-banner__description,
.ecl-banner__description-link {
color: map.get($theme, 'color', 'white');
}

.ecl-banner__description {
padding-top: 0;
}
Expand Down

1 comment on commit f6b93e4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.