Skip to content

Commit

Permalink
feat: introduce $ouds-border-radius-9999 raw token and create a `px…
Browse files Browse the repository at this point in the history
…-to-rem` Sass function (#2751)

Co-authored-by: louismaxime.piton <[email protected]>
  • Loading branch information
julien-deramond and louismaximepiton authored Oct 3, 2024
1 parent ffe58d8 commit 08b7004
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 3 deletions.
11 changes: 11 additions & 0 deletions scss/_functions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,14 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
}
@return $result;
}

// OUDS mod
@function strip-units($value) {
@return divide($value, $value * 0 + 1);
}

@function px-to-rem($value) {
$rem-value: strip-units($value) * .0625; // Assumes the browser default, typically `16px`
@return #{$rem-value}rem;
}
// End mod
2 changes: 1 addition & 1 deletion scss/_ouds-maps.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $ouds-border-radiuses: (
"short": $ouds-border-radius-short,
"medium": $ouds-border-radius-medium,
"tall": $ouds-border-radius-tall,
"pill": $ouds-border-radius-pill,
"pill": px-to-rem($ouds-border-radius-pill),
"circle": 50%
) !default;

Expand Down
2 changes: 1 addition & 1 deletion scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ $border-radius-sm: $ouds-border-radius-short !default; // OUDS mod: i
$border-radius-lg: $ouds-border-radius-medium !default; // OUDS mod: instead of `.5rem`
$border-radius-xl: $ouds-border-radius-tall !default; //OUDS mod: instead of `1rem`
$border-radius-xxl: $ouds-border-radius-tall * 1.5 !default; // OUDS mod: instead of `2rem`
$border-radius-pill: $ouds-border-radius-pill !default; // OUDS mod: instead of `50rem`
$border-radius-pill: px-to-rem($ouds-border-radius-pill) !default; // OUDS mod: instead of `50rem`
// scss-docs-end border-radius-variables
// fusv-disable
$border-radius-2xl: $border-radius-xxl !default; // Deprecated in Bootstrap v5.3.0
Expand Down
1 change: 1 addition & 0 deletions scss/tokens/_raw.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ $ouds-border-radius-300: $ouds-border-base * 3 !default;
// $ouds-border-radius-500: $ouds-border-base * 5 !default;
// $ouds-border-radius-600: $ouds-border-base * 6 !default;
// $ouds-border-radius-800: $ouds-border-base * 8 !default;
$ouds-border-radius-9999: 2000px !default;

// $ouds-border-style-none: none !default;
$ouds-border-style-solid: solid !default;
Expand Down
2 changes: 1 addition & 1 deletion scss/tokens/_semantic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $ouds-border-radius-default: $ouds-border-radius-0 !default;
$ouds-border-radius-short: $ouds-border-radius-75 !default;
$ouds-border-radius-medium: $ouds-border-radius-150 !default;
$ouds-border-radius-tall: $ouds-border-radius-300 !default;
$ouds-border-radius-pill: 125rem !default;
$ouds-border-radius-pill: $ouds-border-radius-9999 !default;

$ouds-border-style-default: $ouds-border-style-solid !default;
$ouds-border-style-drag: $ouds-border-style-dashed !default;
Expand Down
1 change: 1 addition & 0 deletions site/content/docs/0.0/migration-from-boosted.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Technically, it means that you can get rid of the following things:
<li><code>$ouds-border-radius-75</code></li>
<li><code>$ouds-border-radius-150</code></li>
<li><code>$ouds-border-radius-300</code></li>
<li><code>$ouds-border-radius-9999</code></li>
<li><code>$ouds-border-radius-default</code></li>
<li><code>$ouds-border-radius-medium</code></li>
<li><code>$ouds-border-radius-none</code></li>
Expand Down
1 change: 1 addition & 0 deletions site/content/docs/0.0/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ toc: true
<li><code>$ouds-border-radius-75</code></li>
<li><code>$ouds-border-radius-150</code></li>
<li><code>$ouds-border-radius-300</code></li>
<li><code>$ouds-border-radius-9999</code></li>
<li><code>$ouds-border-radius-default</code></li>
<li><code>$ouds-border-radius-medium</code></li>
<li><code>$ouds-border-radius-none</code></li>
Expand Down

0 comments on commit 08b7004

Please sign in to comment.