Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Mixin

@mixin text-style($size-key, $weight-key: regular, $mode: desktop) {
  $sizes: if($mode == desktop, $sizes-desktop, $sizes-mobile);

  font-family: $font-family-base;
  font-size: map.get($sizes, $size-key);
  line-height: map.get($sizes, $size-key);
  font-weight: map.get($font-weights, $weight-key);
}

Cette mixin permet d’appliquer une règle typographique complète (police, taille, interligne, poids) à partir de clés logiques comme heading-h2, text-sm, etc.

Le paramètre $mode permet de basculer dynamiquement entre mobile et desktop.

les clés sont dans typography.scss

✅ Exemple d’utilisation d’une font


@use '../../../styles/abstracts/typography' as typo;

h2 {
  @include typo.text-style(heading-h2, extrabold, mobile);
}

Cet exemple applique :

  • la police “Open Sans”
  • une taille adaptée à un titre de niveau 2
  • un poids fort (extrabold)
  • un interligne cohérent avec la maquette``

Documentation des paramètres typographiques

Paramètres

ParamètreTypeValeurs possiblesDéfautDescription
$size-keystringVoir tableaux ci-dessousClé de taille (définit font-size & line-height)
$weight-keystringregular, semibold, bold, extraboldregularPoids de police
$modestringdesktop, mobiledesktopMode d’affichage (pour responsive)

Tailles disponibles (en px)

Desktop

Cléfont-size / line-height
display-h180px
display-h260px
display-h348px
display-h436px
display-h524px
display-h620px
heading-h130px
heading-h224px
heading-h320px
heading-h418px
heading-h516px
heading-h614px
text-lg18px
text-md16px
text-sm14px
text-xs12px
text-xxs10px

Mobile

Cléfont-size / line-height
display-h148px
display-h236px
display-h328px
display-h424px
display-h518px
display-h616px
heading-h124px
heading-h220px
heading-h318px
heading-h416px
heading-h514px
heading-h612px
text-lg16px
text-md14px
text-sm12px
text-xs10px
text-xxs9px

Poids disponibles

CléValeur CSS
regular400
semibold600
bold700
extrabold800