Skip to content

Commit 575f664

Browse files
authored
Merge pull request #1 from linuxfoundation/IN-152-typography-rules
added typography rules
2 parents 83e9295 + a609511 commit 575f664

File tree

6 files changed

+894
-684
lines changed

6 files changed

+894
-684
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
"scripts": {
55
"ng": "ng",
66
"build-palette": "ts-node -O '{\"module\": \"commonjs\"}' ./scripts/build-palette.ts",
7-
"build-typography": "ts-node -O '{\"module\": \"commonjs\"}' ./scripts/build-typography.ts",
87
"build-colors": "ts-node -O '{\"module\": \"commonjs\"}' ./scripts/build-colors.ts",
98
"build-constants": "ts-node -O '{\"module\": \"commonjs\"}' ./scripts/build-constants.ts",
109
"start": "ng serve",
1110
"increase-patch": "npm version patch --prefix projects/lfx-component-lib",
12-
"prebuild": "npm run increase-patch && npm run build-constants && npm run build-typography && npm run build-colors",
11+
"prebuild": "npm run increase-patch && npm run build-constants && npm run build-colors",
1312
"build": "ng build",
1413
"postbuild": "npm run build --prefix projects/lfx-component-lib",
1514
"watch": "ng build --watch --configuration development",

projects/lfx-component-lib/README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,27 @@
33
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.1.0.
44

55
## Installation with NG CLI
6+
67
`ng add lfx-component-lib`
78

89
## Code scaffolding
910

1011
Run `ng generate component component-name --project lfx-component-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project lfx-component-lib`.
11-
> Note: Don't forget to add `--project lfx-component-lib` or else it will be added to the default project in your `angular.json` file.
12+
13+
> Note: Don't forget to add `--project lfx-component-lib` or else it will be added to the default project in your `angular.json` file.
14+
15+
## Scaffolding with Storybook using lfx-ng-schematics (see: https://github.com/linuxfoundation/lfx-ng-schematics for details)
16+
17+
Run `ng g lfx-ng-schematics:lfx-c --name <name of component>`
1218

1319
## Build
1420

15-
Run `ng build lfx-component-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
21+
Run `yarn build` to build the project. The build artifacts will be stored in the `dist/` directory.
1622

1723
## Publishing
1824

19-
After building your library with `ng build lfx-component-lib`, go to the dist folder `cd dist/lfx-component-lib` and run `npm publish`.
25+
This project already has the github workflows setup, simple push your branch and file a PR for it to be merged to main.
26+
This will create a published version of the package. (Note: This will soon be changed to release tags)
2027

2128
## Running unit tests
2229

@@ -30,4 +37,7 @@ To get more help on the Angular CLI use `ng help` or go check out the [Angular C
3037

3138
To start storybook run `npm run storybook` and navigate to `http://localhost:6006/`.
3239
To get access to Figma designs in Design tab add `STORYBOOK_FIGMA_ACCESS_TOKEN` to your environment variables. To generate Figma personal access token follow [this guide](https://www.figma.com/developers/api#access-tokens).
40+
41+
```
42+
3343
```
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
/*!
2+
* Copyright The Linux Foundation and each contributor to LFX.
3+
* SPDX-License-Identifier: MIT
4+
*/
15

26
body {
3-
color: #282e32
7+
color: #282e32;
48
}
59

6-
.primary {
7-
color: #282e32;
10+
.primary {
11+
color: #282e32;
812
}
913

10-
11-
.secondary {
12-
color: #808b91;
14+
.secondary {
15+
color: #808b91;
1316
}
Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,64 @@
1+
/*!
2+
* Copyright The Linux Foundation and each contributor to LFX.
3+
* SPDX-License-Identifier: MIT
4+
*/
15

2-
body {
3-
font-family: Open Sans, Roboto Slab, sans-serif;
6+
html {
7+
// resetting the font-size
8+
font-size: 100%; // 16px
49
}
510

6-
.page-title {
7-
font-size: 22px;
11+
body,
12+
span,
13+
p,
14+
a {
15+
font-family:
16+
Open Sans,
17+
sans-serif;
18+
font-size: 0.875rem;
19+
font-weight: 400;
20+
line-height: 1rem;
821
}
922

23+
small {
24+
// marked as body2 in figma
25+
font-family: "Open Sans", sans-serif;
26+
font-size: 0.688rem;
27+
font-weight: 400;
28+
font-size: 0.875rem;
29+
}
30+
31+
h1 {
32+
font-family: "Roboto Slab", sans-serif;
33+
font-size: 1.375rem;
34+
font-weight: 700;
35+
line-height: 1.625rem;
36+
}
37+
38+
h2 {
39+
font-family: "Roboto Slab", sans-serif;
40+
font-size: 1.125rem;
41+
font-weight: 600;
42+
line-height: 1.375rem;
43+
}
44+
45+
h3 {
46+
font-family: "Open Sans", sans-serif;
47+
font-size: 1rem;
48+
font-weight: 600;
49+
line-height: 1.125rem;
50+
}
51+
52+
h4 {
53+
font-family: "Open Sans", sans-serif;
54+
font-size: 0.875rem;
55+
font-weight: 600;
56+
line-height: 1rem;
57+
}
1058

11-
.section-title {
12-
font-size: 18px;
59+
h5 {
60+
font-family: "Open Sans", sans-serif;
61+
font-size: 0.75rem;
62+
font-weight: 600;
63+
line-height: 0.875rem;
1364
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { Meta, StoryObj } from '@storybook/angular';
2+
3+
const meta: Meta = {
4+
title: 'LFX Components/Themes/Typography',
5+
tags: ['autodocs'],
6+
};
7+
8+
export default meta;
9+
type Story = StoryObj;
10+
11+
export const BodyText: Story = {
12+
render: () => ({
13+
template: `
14+
<p>This is a paragraph of body text. It uses Open Sans, sans-serif font with a size of 0.875rem (14px) and line height of 1rem (16px).</p>
15+
`,
16+
}),
17+
};
18+
19+
export const SmallText: Story = {
20+
render: () => ({
21+
template: `
22+
<small>This is small text, also known as body2 in Figma. It uses Open Sans, sans-serif font with a size of 0.875rem (14px).</small>
23+
`,
24+
}),
25+
};
26+
27+
export const Heading1: Story = {
28+
render: () => ({
29+
template: `
30+
<h1>This is a Heading 1</h1>
31+
<p>It uses Roboto Slab, sans-serif font with a size of 1.375rem (22px) and line height of 1.625rem (26px).</p>
32+
`,
33+
}),
34+
};
35+
36+
export const Heading2: Story = {
37+
render: () => ({
38+
template: `
39+
<h2>This is a Heading 2</h2>
40+
<p>It uses Roboto Slab, sans-serif font with a size of 1.125rem (18px) and line height of 1.375rem (22px).</p>
41+
`,
42+
}),
43+
};
44+
45+
export const Heading3: Story = {
46+
render: () => ({
47+
template: `
48+
<h3>This is a Heading 3</h3>
49+
<p>It uses Open Sans, sans-serif font with a size of 1rem (16px) and line height of 1.125rem (18px).</p>
50+
`,
51+
}),
52+
};
53+
54+
export const Heading4: Story = {
55+
render: () => ({
56+
template: `
57+
<h4>This is a Heading 4</h4>
58+
<p>It uses Open Sans, sans-serif font with a size of 0.875rem (14px) and line height of 1rem (16px).</p>
59+
`,
60+
}),
61+
};
62+
63+
export const Heading5: Story = {
64+
render: () => ({
65+
template: `
66+
<h5>This is a Heading 5</h5>
67+
<p>It uses Open Sans, sans-serif font with a size of 0.75rem (12px) and line height of 0.875rem (14px).</p>
68+
`,
69+
}),
70+
};
71+
72+
export const AllTypography: Story = {
73+
render: () => ({
74+
template: `
75+
<h1>Heading 1</h1>
76+
<h2>Heading 2</h2>
77+
<h3>Heading 3</h3>
78+
<h4>Heading 4</h4>
79+
<h5>Heading 5</h5>
80+
<p>This is a paragraph of body text.</p>
81+
<small>This is small text (body2).</small>
82+
`,
83+
}),
84+
};

0 commit comments

Comments
 (0)