Skip to content

Feature/headings list#247

Merged
francoistibo merged 5 commits intomasterfrom
feature/headings-list
Sep 26, 2022
Merged

Feature/headings list#247
francoistibo merged 5 commits intomasterfrom
feature/headings-list

Conversation

@firestar300
Copy link
Contributor

@firestar300 firestar300 commented Jun 23, 2022

Dans cette PR, on a un second paramètre sur la mixin heading pour gérer les styles du composant core/heading. Par défault, nous avons que le style par défaut mais sur certains projets il est possible d'avoir un style particulier. Un exemple concret sur les h2, h3 et h4 qu'on pourrait avoir en uppercase, ça donnerait :

_heading.scss

$headings: (
    "1": (),
    "2": (
        "uppercase"
    ),
    "3": (
        "uppercase"
    ),
    "4": (
        "uppercase"
    ),
    "5": (),
    "6": (),
);

@each $i, $styles in $headings {
    h#{$i},
    .is-style-h#{$i} {
        @include heading(h#{$i});

        @each $style in $styles {
            &.is-style-#{$style} {
                @include heading(h#{$i}, $style);
            }
        }
    }

    .has-h-#{$i}-font-size {
        font-size: var(--font-size-h#{i});
    }
}

_m-heading.scss

@mixin heading($name: h1, $style: default) {
    font-family: $font-family-primary;
    font-weight: 400;

    @if $name == h1 {
        font-size: var(--heading--font-size-h1);
        line-height: var(--heading--line-height-h1);
    }

    @if $name == h2 {
        font-size: var(--heading--font-size-h2);
        line-height: var(--heading--line-height-h2);

        @if $style == uppercase {
            text-transform: uppercase;
        }
    }

    @if $name == h3 {
        font-size: var(--heading--font-size-h3);
        line-height: var(--heading--line-height-h3);

        @if $style == uppercase {
            text-transform: uppercase;
        }
    }

    @if $name == h4 {
        font-size: var(--heading--font-size-h4);
        line-height: var(--heading--line-height-h4);

        @if $style == uppercase {
            text-transform: uppercase;
        }
    }

    @if $name == h5 {
        font-size: var(--heading--font-size-h5);
        line-height: var(--heading--line-height-h5);
    }

    @if $name == h6 {
        font-size: var(--heading--font-size-h6);
        line-height: var(--heading--line-height-h6);
    }
}

Je corrige une typo sur les commentaires de certains fichiers *.scss

@firestar300 firestar300 marked this pull request as ready for review September 15, 2022 13:10
francoistibo
francoistibo previously approved these changes Sep 16, 2022
@francoistibo francoistibo merged commit 2abe221 into master Sep 26, 2022
@francoistibo francoistibo deleted the feature/headings-list branch September 26, 2022 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants