Skip to content

Commit 36dbfe8

Browse files
authored
feat(design): allow the whole typography subpackaged to be exported and allow font family variables to be assignable (#2762)
1 parent ddb9864 commit 36dbfe8

File tree

5 files changed

+37
-19
lines changed

5 files changed

+37
-19
lines changed

apps/design-land/src/app/typography/typography.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ <h1>Typography</h1>
22
<p>We use typography to establish hierarchy, organize information, and guide our users through a product or experience.</p>
33

44
<h2>Type scale</h2>
5-
<p>The Design Land typopgrahic scale is designed with visual distinctions to help our users better understand content and UI. Text sizes, styles, and layouts were selected to maintain logical hierarchies and drive consistency throughout an application.</p>
5+
<p>The typopgrahic scale is designed with visual distinctions to help our users better understand content and UI. Text sizes, styles, and layouts were selected to maintain logical hierarchies and drive consistency throughout an application.</p>
66

77
<h3>8px system</h3>
88
<p>Our type scale is based on an 8px system, where the type is largely divisible by 8. For smaller sizes, the system allows for the scale to be divisble by 4.</p>

libs/design/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
"./scss/utilities": {
6161
"sass": "./scss/utilities.scss"
6262
},
63-
"./scss/typography/classes": {
64-
"sass": "./scss/typography/_classes.scss"
63+
"./scss/typography": {
64+
"sass": "./scss/typography/_index.scss"
6565
}
6666
}
6767
}

libs/design/scss/typography/README.md

+19-11
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
11
# Typography
2-
Daffodil uses typography to establish hierarchy and create clear visual patterns to guide users through a product or experience.
2+
Daffodil uses typography to establish hierarchy, organize information, and guide our users through a product or experience.
33

44
## Usage
5-
To include typography in your project, you can add the following in your Sass file:
5+
To include typography in your project, you can include the following in your Sass file:
66

77
```scss
8-
@use '@daffodil/design/scss/utilities';
8+
@use '@daffodil/design/scss/typography';
99
```
1010

1111
## Type Scale
12-
`@daffodil/design`'s typographic scale is designed with visual distinctions to help users better understand content and UI. Text sizes, styles, and layouts have been chosen to maintain logical hierarchies and drive consistency throughout an application.
12+
The typographic scale is designed with visual distinctions to help users better understand content and UI. Text sizes, styles, and layouts have been chosen to maintain logical hierarchies and drive consistency throughout an application.
1313

1414
### 8px System
1515
Our type scale is based on an 8px system, where the type is largely divisible by 8. For smaller sizes, the system allows for the scale to be divisible by 4. Font sizes are typically smaller on mobile and scaled up at the `tablet` breakpoint to be larger on desktop.
1616

17-
## Font Stack
18-
Daffodil uses a system font stack to maximize on performance, legibility, and accessibility. System fonts play into the improvement of today's rich displays Additionally, system fonts provides a seamless experience for users because the application feel more like it blends in with their device's OS.
17+
## Default Font Stack
18+
By default, Daffodil uses a system font stack to maximize on performance, legibility, and accessibility. System fonts play into the improvement of today's rich displays Additionally, system fonts provides a seamless experience for users because the application feel more like it blends in with their device's OS.
1919

2020
```scss
21-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
21+
&dollar;font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
2222
```
2323

2424
* `-apple-system` and `BlinkMacSystemFont` targets default fonts in Safari, Firefox, and Chrome on macOS and iOS.
2525
* `Segoe UI` is the system font for Windows.
2626
* `Helvetica` and `Arial` are added as fallbacks.
2727
* `Apple Color Emoji`, `Segoe UI Emoji`, and `Segoe UI Symbol` are included so that emojis are rendered correctly in macOS and Windows.
2828

29+
To customize your project's font stack, you can pass the `$font-family-base` variable to the typography module in your `style.scss` file:
30+
31+
```scss
32+
@use '@daffodil/design/scss/typography' with (
33+
$font-family-base: 'Arial',
34+
);
35+
```
36+
2937
## Typography Mixins
3038
Typography mixins are used to keep typography consistent with logical hierarchies. Utilizing the mixin ensures that content within the UI are clear and easily recognizable. Mixins are available for headlines, body, subheading, and caption. They are used within the `@daffodil/design` components and can also be used within custom CSS.
3139

@@ -46,10 +54,10 @@ The headline mixins are responsive and will adjust at the `tablet` breakpoint.
4654

4755
**Example:**
4856
```scss
49-
@use '@daffodil/design/scss/utilities';
57+
@use '@daffodil/design/scss/typography';
5058

5159
.title {
52-
@include utilities.headline-xl;
60+
@include typography.headline-xl();
5361
}
5462
```
5563

@@ -67,13 +75,13 @@ The headline mixins are responsive and will adjust at the `tablet` breakpoint.
6775
You can include the typography utility classes in your project by writing the following in your Sass file:
6876

6977
```scss
70-
@use '@daffodil/design/scss/typography/classes';
78+
@use '@daffodil/design/scss/typography';
7179
```
7280

7381
Otherwise, you can use the mixins in your project by using the following module in your Sass file:
7482

7583
```scss
76-
@use '@daffodil/design/scss/utilities';
84+
@use '@daffodil/design/scss/typography';
7785
```
7886

7987
## Typography Variables
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1+
@forward 'utilities';
12
@forward 'mixins/font-weight';
23
@forward 'mixins/sizes';
34
@forward 'mixins/text-truncate';
4-
@forward 'utilities';

libs/design/scss/typography/utilities/_variables.scss

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
$body-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica,
2-
Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
1+
$font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica,
2+
Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji' !default;
3+
$font-family-mono: ui-monospace, 'SFMono-Regular', SF Mono, Menlo, Consolas,
4+
'Liberation Mono', monospace !default;
5+
6+
// these three variables will be deprecated in v1.0.0 in favor of more consistent naming
7+
$body-font-family: $font-family-base;
38
$base-font-family: $body-font-family;
4-
$monospace-font-family: ui-monospace, 'SFMono-Regular', SF Mono, Menlo, Consolas,
5-
'Liberation Mono', monospace;
9+
$monospace-font-family: $font-family-mono;
10+
11+
$font-size-sm: 0.875rem;
12+
$font-size-base: 1rem;
13+
$font-size-md: 1.25rem;
14+
$font-size-lg: 1.5rem;
615

16+
// these variables will be deprecated in v1.0.0 in favor of more consistent naming
717
$large-font-size: 1.5rem;
818
$medium-font-size: 1.25rem;
919
$normal-font-size: 1rem;

0 commit comments

Comments
 (0)