Skip to content

Commit

Permalink
KAW-7710-section center class
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakshmishri committed Aug 2, 2024
1 parent 057032d commit 178a7ee
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
2 changes: 1 addition & 1 deletion blocks/text/text.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
max-width: 750px;
}

.text.center > div {
.text--center > div {
margin: auto;
}
9 changes: 8 additions & 1 deletion blocks/text/text.js
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
/* JS */
import { variantsClassesToBEM } from '../../scripts/scripts.js';

const variantClasses = ['center'];
const blockName = 'text';

export default async function decorate(block) {
variantsClassesToBEM(block.classList, variantClasses, blockName);
}
9 changes: 9 additions & 0 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,12 @@ export function getTextLabel(key) {

placeholders = await fetchPlaceholders();
loadPage();

export const variantsClassesToBEM = (blockClasses, expectedVariantsNames, blockName) => {
expectedVariantsNames.forEach((variant) => {
if (blockClasses.contains(variant)) {
blockClasses.remove(variant);
blockClasses.add(`${blockName}--${variant}`);
}
});
};
29 changes: 28 additions & 1 deletion styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ a:any-link {
}

a:hover {
text-decoration: underline;
color: var(--link-hover-color);
}

Expand Down Expand Up @@ -290,3 +289,31 @@ main .section.highlight {
margin-right: calc(5px + 0.2em);
border-left: calc(5px + 0.1em) solid #f00;
}

.section .width-medium {
max-width: 300px;
margin: auto;
}

.section.text-center {
text-align: center;
}

main .border-top {
border-top: 1px solid #e5e5e5;
margin-top: 40px;
padding-top: 40px;
}

.button.secondary:any-link {
background-color: transparent;
border: none;
color: var(--link-color);
font-weight: 400;
font-size: 16px;
text-transform: capitalize;
}

.button.secondary:any-link:hover {
color: var(--text-color);
}

0 comments on commit 178a7ee

Please sign in to comment.