From 0d2e3277701c11f59c291c844e9635c82d61c2d9 Mon Sep 17 00:00:00 2001 From: JF-Cozy <julien.ficheux@cozycloud.cc> Date: Mon, 24 Aug 2020 14:30:07 +0200 Subject: [PATCH] feat: Add font-weight to styleguide --- stylus/cozy-ui/build.styl | 27 ++++++++++++++++++++++----- stylus/utilities/text.styl | 16 +++++++++++++++- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/stylus/cozy-ui/build.styl b/stylus/cozy-ui/build.styl index dfff16bf3b..844b5f5ef9 100644 --- a/stylus/cozy-ui/build.styl +++ b/stylus/cozy-ui/build.styl @@ -889,6 +889,23 @@ Display an chip that represents complex identity Styleguide utilities.text.fontstyle */ +/* + Font-weight + + Sets a font-weight to a text<br> +[Can be used with breakpoints modifier suffixes (`-t`,`-s`,`-m`)](section-settings.html#kssref-settings-breakpoints) + + Markup: + <p class="{{modifier_class}}">Facilisis eget nam turpis id adipiscing facilisi odio ut fames, aliquet laoreet felis habitasse tincidunt litora leo senectus.</p> + + .u-fw-normal - Sets a normal font weight + .u-fw-bold - Sets a bold font weight + + Weight: 9 + + Styleguide utilities.text.fontweight +*/ + /* Text alignement @@ -903,7 +920,7 @@ Display an chip that represents complex identity .u-ta-center - Sets a center alignment .u-ta-justify - Sets a justify alignment - Weight: 9 + Weight: 10 Styleguide utilities.text.alignment */ @@ -919,7 +936,7 @@ Display an chip that represents complex identity .u-ellipsis - Ellipsis at the end - Weight: 10 + Weight: 11 Styleguide utilities.text.ellipsis */ @@ -936,7 +953,7 @@ Display an chip that represents complex identity .u-spacellipsis - Ellipsis at the end but keeps breaking spaces - Weight: 11 + Weight: 12 Styleguide utilities.text.spacellipsis */ @@ -953,7 +970,7 @@ Display an chip that represents complex identity .u-midellipsis - Ellipsis in the middle - Weight: 12 + Weight: 13 Styleguide utilities.text.midellipsis */ @@ -967,7 +984,7 @@ Display an chip that represents complex identity .u-link - Link style - Weight: 13 + Weight: 14 Styleguide utilities.text.link */ diff --git a/stylus/utilities/text.styl b/stylus/utilities/text.styl index 2f5aeca39d..75dea6aa52 100644 --- a/stylus/utilities/text.styl +++ b/stylus/utilities/text.styl @@ -174,11 +174,25 @@ fontstyle = { 'fs-normal': 'fs-normal', 'fs-italic': 'fs-italic' } - if cssmodules == true cssModulesUtils(fontstyle, breakpoints) else nativeUtils(fontstyle, breakpoints) + +fw-normal() + font-weight normal + +fw-bold() + font-weight bold + +fontweight = { + 'fw-normal': 'fw-normal', + 'fw-bold': 'fw-bold' +} +if cssmodules == true + cssModulesUtils(fontweight, breakpoints) +else + nativeUtils(fontweight, breakpoints) // @stylint on // Global classes