Skip to content

Commit

Permalink
[V3][RL] Rename theme font spec key, amend documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
qroll committed Oct 7, 2024
1 parent 2438802 commit 107c224
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/theme/font-spec/theme-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export const getFontSpec = (key: keyof FontSpecSet) => {
theme.fontScheme
);

if (theme.overrides && theme.overrides.fontspec) {
return getValue(fontSpecSet, key, theme.overrides.fontspec);
if (theme.overrides && theme.overrides.fontSpec) {
return getValue(fontSpecSet, key, theme.overrides.fontSpec);
} else {
return fontSpecSet[key];
}
Expand Down
4 changes: 2 additions & 2 deletions src/theme/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ export type BreakpointScheme = "lifesg";
export interface ThemeSpecOptions {
primitiveColour?: PrimitiveColourSetOptions | undefined;
semanticColour?: SemanticColourSetOptions | undefined;
fontspec?: FontSpecSetOptions | undefined;
fontSpec?: FontSpecSetOptions | undefined;
font?: FontSetOptions | undefined;
motion?: MotionSetOptions | undefined;
spacing?: SpacingSetOptions | undefined;
border?: BorderSetOptions | undefined;
radius?: RadiusSetOptions | undefined;
breakpoint?: BreakpointSetOptions | undefined;
font?: FontSetOptions | undefined;
}

export interface ThemeSpec {
Expand Down
12 changes: 6 additions & 6 deletions stories/theme/typography/a-typography-introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import { DocInfo, DocNote } from "stories/storybook-common";
import { FontSpec, Font } from "@lifesg/react-design-system/theme";
```

The **fontspec** tokens define these font styling properties:
The **font spec** tokens define these font styling properties:

- font family
- font size
- font weight
- line height
- letter spacing

A **font** token is a combination of these font tokens.
A **font** token is a combination of these font spec tokens.

## Collections

Expand All @@ -31,7 +31,7 @@ A **font** token is a combination of these font tokens.
## Usage

<DocInfo storybookLink={"../?path=/docs/core-typography--docs"}>
In most cases, you can simply use the `Font` component to render text
In most cases, you can simply use the `Typography` component to render text
elements
</DocInfo>

Expand Down Expand Up @@ -60,10 +60,10 @@ const Icon = styled.svg`

## Overriding

When you modify a fontspec token, any font token referring to it will also
When you modify a font spec token, any font token referring to it will also
reflect the new specification.

FontSpec tokens should be `rem`-based to scale with the user's preferred font size.
Font spec tokens should be `rem`-based to scale with the user's preferred font size.

While not recommended, font tokens can be overridden separately. You are
responsible for ensuring all relevant properties are included.
Expand All @@ -74,7 +74,7 @@ import { LifeSGTheme } from "@lifesg/react-design-system/theme";
const customTheme: ThemeSpec = {
...LifeSGTheme,
overrides: {
fontspec: {
fontSpec: {
"header-size-xxl": "5rem", // specify a custom value
},
font: {
Expand Down
2 changes: 1 addition & 1 deletion stories/theme/typography/b-typography-lifesg.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FontDisplay } from "../doc-elements";

# LifeSG font

This is the fontspec set used when the `fontScheme` is `"lifesg"`.
This is the font set used when the `fontScheme` is `"lifesg"`.

```tsx
const theme: ThemeSpec = {
Expand Down
2 changes: 1 addition & 1 deletion tests/theme/theme-font.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe("StyledFontTests", () => {
);
});

it("should apply correct fontspec styles based on the theme", () => {
it("should apply correct font spec styles based on the theme", () => {
const overrideTheme: ThemeSpec = {
colourScheme: "lifesg",
fontScheme: "lifesg",
Expand Down

0 comments on commit 107c224

Please sign in to comment.