Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lineLength): Add class to limit line length #883

Merged
merged 6 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bundlewatch.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"files": [
{
"path": "./dist/css/boosted-grid.css",
"maxSize": "9.8 kB"
"maxSize": "9.9 kB"
},
{
"path": "./dist/css/boosted-grid.min.css",
Expand Down
8 changes: 8 additions & 0 deletions scss/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,14 @@ $utilities: map-merge(
lg: $line-height-lg,
)
),
"line-length": (
property: max-width,
class: ll,
values: (
sm: $small-line-length,
md: $medium-line-length,
)
),
"text-align": (
responsive: true,
property: text-align,
Expand Down
2 changes: 2 additions & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,8 @@ $line-height-base: calc(18 / 16) !default;
$line-height-sm: calc(16 / 14) !default;
$line-height-lg: calc(30 / 16) !default;
// stylelint-enable function-disallowed-list
$small-line-length: 32ch !default;
julien-deramond marked this conversation as resolved.
Show resolved Hide resolved
$medium-line-length: 65ch !default;
julien-deramond marked this conversation as resolved.
Show resolved Hide resolved
$letter-spacing-base: $spacer * -.005 !default; // -0.1px

$h1-font-size: $font-size-base * 2.125 !default; // 34px
Expand Down
6 changes: 6 additions & 0 deletions site/content/docs/5.1/getting-started/accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ When using a fixed (or sticky) header, tabbing backward often hides focused elem
Boosted provides `target-size()` mixin to ensure a minimum target size, adding a centered pseudo-element with a minimum size —defaulting to `44px` to pass [WCAG 2.1 "Target Size" Success Criterion (2.5.5)](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html)— alongside a few arguments to fit specific needs (eg. different width and height, using `::after` instead of `::before`, etc.).

{{< scss-docs name="target-size" file="scss/mixins/_target-size.scss" >}}

### Maximum line length

When writing a paragraph, it is commonly admitted that a line should have 80 characters as a maximum. This phenomenon is carefully explained at [C20 : Using relative measurements to set column widths](https://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/C20). This rule applies also to the [Orange's Web Browsing Guidelines](https://design.orange.com/guidelines/web-browsing) at Typography.
julien-deramond marked this conversation as resolved.
Show resolved Hide resolved

This feature is a bit more explained at [text utilities](/docs/5.1/utilities/text/#line-length).
<!-- End mod -->

## Additional resources
Expand Down
10 changes: 10 additions & 0 deletions site/content/docs/5.1/utilities/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ Change the line height with `.lh-*` utilities.
<p class="lh-lg">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
{{< /example >}}

## Line length

Limit the line length with `.ll-*` utilities. It applies `max-width` rule to an element with a width based on `ch` dimension.
julien-deramond marked this conversation as resolved.
Show resolved Hide resolved

{{< example >}}
<p class="ll-sm">This is a long paragraph written to show how the line-length of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
<p class="ll-md">This is a long paragraph written to show how the line-length of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
<p class="ll-md fs-3">This is a long paragraph written to show how the line-length of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
{{< /example >}}

## Monospace

Change a selection to our monospace font stack with `.font-monospace`.
Expand Down