Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add display typography styles [OR-1205] #1919

Open
wants to merge 4 commits into
base: 2025-release
Choose a base branch
from

Conversation

notlee
Copy link
Contributor

@notlee notlee commented Jan 9, 2025

Add token attributes to the tooling export
The token export for tooling includes extra attributes to make it easier to identify groups of type tokens after the token tree has been flattened.

Add a utility class for display typography usecases

  • Ensure the default font family has low specificity with :where
  • Add storybook demos which point to the website. Otherwise we will
    just be repeating information and doubling work. We may want to revisit
    this.

Refactor the Preview component
A new PreviewPane component is responsible for the UI of the preview
interface. This makes it more flexible. It can now be used for smaller
previews, such as for utility classes which aren't a component and
do not have JSX.

The Preview component retains logic to render a JSX component,
fetch its JSX from a given file path for a code snippet, and
generates a HTML code snippet from there.

Add display type usecase docs to the website

This differs to the Figma view because:

  1. We need a code snippet for the class.
  2. We need to document each of the CSS Custom Properties which make up the composite token. This is handy to apply these styles without needing to make markup changes.
Screenshot 2025-01-09 at 18 17 24 Screenshot 2025-01-09 at 18 17 27

notlee added 4 commits January 9, 2025 18:20
- Ensure the default font family has low specificity with `:where`
- Add storybook demos which point to the website. Otherwise we will
just be repeating information and doubling work. We may want to revisit
this.
A new PreviewPane component is responsible for the UI of the preview
interface. This makes it more flexible. It can now be used for smaller
previews, such as for utility classes which aren't a component and
do not have JSX.

The Preview component retains logic to render a JSX component,
fetch its JSX from a given file path for a code snippet, and
generates a HTML code snippet from there.
@notlee notlee temporarily deployed to origami-webs-2025-relea-f8zqtf January 9, 2025 18:43 Inactive


Object.entries(TypeUsecaseTokensByItem).map(([key, tokens]) => {
console.log(tokens);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, thanks

border-radius: 50%;
}

/* LABEL ADDED BY BRIAN */
Copy link
Contributor

@frshwtr frshwtr Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who is brian? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea 🤔 This was authored by Ako so we'll never know 🎻


Font weight can be used to express hierarchy or urgency of information.

We recommend using our standard [UI typography](#ui-typography) <BrandedContent currentBrand={props.brand} brands="core, professional, sustainable-views, whitelabel">or [Editorial typography](#editorial-typography)</BrandedContent> styles where possible. For custom typography, align to these standard styles where possible. For example when using Metric2 for UI use `semibold` over other bold weights.
Copy link
Contributor

@frshwtr frshwtr Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example when using Metric2 for UI use semibold over other bold weights. Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Let's save this kind of feedback for a review of type guidelines when we're done. I'm adding new usecases here but not removing any old stuff yet. We have another ticket to apply these usecases, which I think should include removing those that have been replaced.

@@ -0,0 +1,16 @@
import { Meta } from '@storybook/blocks';
Copy link
Contributor

@frshwtr frshwtr Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo in the directory path proffesional. Looks like an existing issue though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot. Let's rename in another PR to keep the changelog down


<Meta title="Core/Professional/o3-foundation/o3-typography/Usecases" />

# Typography Usescases
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are nice additions to Storybook :) A note that in future we may run into increased maintenance where one update will need to be applied across multiple files.

It might be possible to extract the contend into a Markdown file and import in mdx

import { Description } from '@storybook/addon-docs/blocks';
import Readme from '.README.md';

<Meta title="Documentation|Readme" />

<Description>{Readme}</Description>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good shout, it's a real pain. I'm also wondering whether with the new tags/filtering feature we can tag stories with brands and avoid a whole load of repetition. I'm going to leave this pre migration though – unless by some miracle we find ourselves with some time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants