Skip to content

Commit

Permalink
Remove scaling of heading elements
Browse files Browse the repository at this point in the history
Also:
* Adjust sizing of headers in v9
* bump up the sizing of `$ouiFontSizeS` and `$ouiFontSizeXS`

Signed-off-by: Miki <miki@amazon.com>
  • Loading branch information
AMoo-Miki committed Sep 6, 2024
1 parent b8a9daa commit d1de432
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 69 deletions.
4 changes: 4 additions & 0 deletions src-docs/src/views/text/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export default () => (
sint deserunt laboris. Excepteur nisi sint do non.
</p>

<h2>This is Heading Two</h2>

<h3>This is Heading Three</h3>

<p>
Consequat consequat duis commodo magna fugiat commodo. Pariatur elit in
sunt eu officia minim ipsum laborum non occaecat magna. Tempor fugiat ex
Expand Down
4 changes: 4 additions & 0 deletions src-docs/src/views/text/text_small.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ const exampleText = (
exercitation laborum cillum.
</p>

<h2>This is Heading Two</h2>

<h3>This is Heading Three</h3>

<p>
Amet qui est et elit magna veniam id enim consequat in. Sunt anim mollit
mollit amet. Dolor amet amet aliquip aute qui aliqua do aliqua id sunt ea.
Expand Down
60 changes: 17 additions & 43 deletions src/components/text/_text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,43 +35,10 @@
font-size: convertToRem($baseFontSize * nth($ouiTextScale, 4));
}

h1,
h2,
h3,
h4,
h5,
h6 {
margin-bottom: convertToRem($baseLineHeightMultiplier * 1);
}

dd + dt {
margin-top: convertToRem($baseLineHeightMultiplier * 2);
}

* + h2,
* + h3,
* + h4,
* + h5,
* + h6 {
margin-top: convertToRem($baseLineHeightMultiplier * 4);
}

h1 {
font-size: convertToRem($baseFontSize * nth($ouiTextScale, 1));
line-height: convertToRem($baseLineHeightMultiplier * 6);
}

h2 {
font-size: convertToRem($baseFontSize * nth($ouiTextScale, 2));
line-height: convertToRem($baseLineHeightMultiplier * 5);
}

h3 {
font-size: convertToRem($baseFontSize * nth($ouiTextScale, 3));
line-height: convertToRem($baseLineHeightMultiplier * 4);
}

h4,
dt,
.oui-definitionListReverse dd {
font-size: convertToRem($baseFontSize * nth($ouiTextScale, 5)); // skip level 4 on purpose
Expand All @@ -83,16 +50,6 @@
color: $ouiTextColor;
}

h5 {
font-size: convertToRem($baseFontSize * nth($ouiTextScale, 6));
line-height: convertToRem($baseLineHeightMultiplier * 2);
}

h6 {
font-size: convertToRem($baseFontSize * nth($ouiTextScale, 7));
line-height: convertToRem($baseLineHeightMultiplier * 2);
}

small {
font-size: convertToRem($baseFontSize * nth($ouiTextScale, 6));
}
Expand Down Expand Up @@ -180,6 +137,23 @@
}
}

h1,
h2,
h3,
h4,
h5,
h6 {
margin-bottom: .5rem;
}

* + h2,
* + h3,
* + h4,
* + h5,
* + h6 {
margin-top: 2rem;
}

h1 {
@include ouiTitle('l');
}
Expand Down
46 changes: 20 additions & 26 deletions src/themes/v9/global_styling/variables/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ $ouiCodeFontFamily: #{"'Fira Code', Consolas, Menlo, Courier, monospace"} !defau
$ouiFontFeatureSettings: 'calt' 1, 'kern' 1, 'liga' 1 !default;

// Font sizes -- scale is loosely based on Major Third (1.250)
$ouiTextScale: 2, 1.7143, 1.2857, 1.125, 1, .875, .75 !default;
$ouiTextScale: 2, 1.714286, 1.285714, 1.1429, 1, .857143, .75 !default;

$ouiFontSize: 16px !default; // 5th position in scale
$ouiFontSizeXS: $ouiFontSize * nth($ouiTextScale, 7) !default; // 12px
$ouiFontSizeS: $ouiFontSize * nth($ouiTextScale, 6) !default; // 14px
$ouiFontSizeM: $ouiFontSize * nth($ouiTextScale, 4) !default; // 18px
$ouiFontSizeL: $ouiFontSize * nth($ouiTextScale, 3) !default; // 20px
$ouiFontSizeXL: $ouiFontSize * nth($ouiTextScale, 2) !default; // 28px
$ouiFontSizeXXL: $ouiFontSize * nth($ouiTextScale, 1) !default; // 36px
$ouiFontSize: 14px !default; // 5th position in scale
$ouiFontSizeXS: $ouiFontSize * nth($ouiTextScale, 6) !default; // 12.25px
$ouiFontSizeS: $ouiFontSize * nth($ouiTextScale, 5) !default; // 14px
$ouiFontSizeM: $ouiFontSize * nth($ouiTextScale, 4) !default; // 15.75px
$ouiFontSizeL: $ouiFontSize * nth($ouiTextScale, 3) !default; // 18px
$ouiFontSizeXL: $ouiFontSize * nth($ouiTextScale, 2) !default; // 24px
$ouiFontSizeXXL: $ouiFontSize * nth($ouiTextScale, 1) !default; // 28px

// This value is impacted by font-size
$ouiLegibilityMaxWidth: 80ch !default;
Expand All @@ -79,39 +79,33 @@ $ouiCodeFontWeightBold: 700 !default;
$ouiTitles: (
'xxxs': (
'font-size': $ouiFontSizeXS,
'line-height': lineHeightFromBaseline(3),
'font-weight': $ouiFontWeightBold,
'letter-spacing': -.005em,
'line-height': lineHeightFromBaseline(2.1429),
'font-weight': $ouiFontWeightMedium,
),
'xxs': (
'font-size': $ouiFontSizeS,
'line-height': lineHeightFromBaseline(3),
'font-weight': $ouiFontWeightSemiBold,
'letter-spacing': -.005em,
'font-size': $ouiFontSizeXS,
'line-height': lineHeightFromBaseline(2.1429),
'font-weight': $ouiFontWeightMedium,
),
'xs': (
'font-size': $ouiFontSize,
'line-height': lineHeightFromBaseline(3),
'font-weight': $ouiFontWeightSemiBold,
'letter-spacing': -.02em,
'line-height': lineHeightFromBaseline(2.8286),
'font-weight': $ouiFontWeightMedium,
),
's': (
'font-size': $ouiFontSizeL,
'line-height': lineHeightFromBaseline(4),
'line-height': lineHeightFromBaseline(3.1429),
'font-weight': $ouiFontWeightMedium,
'letter-spacing': -.025em,
),
'm': (
'font-size': $ouiFontSizeXL,
'line-height': lineHeightFromBaseline(5),
'font-weight': $ouiFontWeightRegular,
'letter-spacing': -.04em,
'line-height': lineHeightFromBaseline(4.1429),
'font-weight': $ouiFontWeightLight,
),
'l': (
'font-size': $ouiFontSizeXXL,
'line-height': lineHeightFromBaseline(6),
'font-weight': $ouiFontWeightRegular,
'letter-spacing': -.03em,
'line-height': lineHeightFromBaseline(4.857),
'font-weight': $ouiFontWeightLight,
),
) !default;

Expand Down

0 comments on commit d1de432

Please sign in to comment.