Skip to content

Commit 06337a0

Browse files
committed
introduced ShwCarbonizationStylePreviewTypography to facilitate comparison of typographic styles
1 parent 1955a14 commit 06337a0

File tree

4 files changed

+39
-8
lines changed

4 files changed

+39
-8
lines changed

showcase/app/components/page-carbonization/foundations/typography.gts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import ShwTextH1 from 'showcase/components/shw/text/h1';
1010

1111
import ShwFlex from 'showcase/components/shw/flex';
1212
import ShwCarbonizationComparisonGrid from 'showcase/components/shw/carbonization/comparison-grid';
13+
import ShwCarbonizationStylePreviewTypography from 'showcase/components/shw/carbonization/style-preview-typography';
1314

1415
import { STYLES_COMBINATIONS } from 'showcase/components/page-foundations/typography/sub-sections/styles';
1516

@@ -68,9 +69,10 @@ const TypographyCarbonization: TemplateOnlyComponent = <template>
6869
<ShwFlex @direction="column" as |SF|>
6970
{{#each weights as |weight|}}
7071
<SF.Item>
71-
<p
72-
class="hds-typography-{{style}} hds-font-weight-{{weight}}"
73-
>{{style}} / {{weight}}</p>
72+
<ShwCarbonizationStylePreviewTypography
73+
@class="hds-typography-{{style}} hds-font-weight-{{weight}}"
74+
@label="{{style}} / {{weight}}"
75+
/>
7476
</SF.Item>
7577
{{/each}}
7678
</ShwFlex>
@@ -81,12 +83,12 @@ const TypographyCarbonization: TemplateOnlyComponent = <template>
8183
{{#each weights as |weight|}}
8284
{{#let (get mappingItem.weights weight) as |mappedWeight|}}
8385
<SF.Item>
84-
<p
85-
class="cds--type-{{mappingItem.mapsTo}}
86-
cds--type-{{mappedWeight}}"
87-
>{{mappingItem.mapsTo}}
86+
<ShwCarbonizationStylePreviewTypography
87+
@class="cds--type-{{mappingItem.mapsTo}} cds--type-{{mappedWeight}}"
88+
@label="{{mappingItem.mapsTo}}
8889
/
89-
{{mappedWeight}}</p>
90+
{{mappedWeight}}"
91+
/>
9092
</SF.Item>
9193
{{/let}}
9294
{{/each}}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { TemplateOnlyComponent } from '@ember/component/template-only';
2+
3+
import ShwLabel from 'showcase/components/shw/label';
4+
5+
export interface ShwCarbonizationStylePreviewTypographySignature {
6+
Args: {
7+
class: string;
8+
label: string;
9+
};
10+
}
11+
12+
const ShwCarbonizationStylePreviewTypography: TemplateOnlyComponent<ShwCarbonizationStylePreviewTypographySignature> =
13+
<template>
14+
<div class="shw-carbonization-style-preview-typography">
15+
<ShwLabel>{{@label}}</ShwLabel>
16+
<p class={{@class}}>Lorem ipsum 123 @&amp;%!?</p>
17+
</div>
18+
</template>;
19+
20+
export default ShwCarbonizationStylePreviewTypography;

showcase/app/styles/app.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191

9292
@use "./showcase-components/carbonization/cds-theming";
9393
@use "./showcase-components/carbonization/comparison-grid";
94+
@use "./showcase-components/carbonization/style-preview-typography";
9495
@use "./showcase-components/carbonization/token-preview-color";
9596
@use "./showcase-pages/carbonization/segmented-group" as carbonization-segmented-group;
9697
@use "./showcase-pages/carbonization/typography" as carbonization-typography;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.shw-carbonization-style-preview-typography {
2+
.shw-label {
3+
margin-bottom: 4px;
4+
color: var(--content-foreground-color);
5+
font-size: 0.7rem;
6+
opacity: 0.6;
7+
}
8+
}

0 commit comments

Comments
 (0)