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

feat(components): add helix product typography #15459

Merged
merged 13 commits into from
Jun 21, 2024

Conversation

sfoster1
Copy link
Member

@sfoster1 sfoster1 commented Jun 18, 2024

This PR implements the new helix product typography system. You can find it here: https://www.figma.com/design/1ot18My22DALIcjdLl5LJh/Helix-Design-System?node-id=3571-46578&t=B4pPbtL9mapki2Jg-4

The Product type system is distinct from at least the Web type system, which will have different styles for readability in a different context. It is currently only defined for places other than the ODD.

This ended up being a big PR because our usage of the StyledText atom had to be changed somewhat.

The change was necessary because the helix product styles do not and are not intended to align with the semantic styling presented by the StyledText component - there is no direct alignment that "when you're making a <p>, you use this style". Instead, the intent is that higher level components will use the style by the name it has in helix, without an explicit semantic link outside of the designs. That makes the way the old styled text works kind of nonsense.

In addition, there are no helix product styles for the ODD, and there is no current map and possibly no intention to have a future map between the semantic styles of the ODD and Desktop. That means that having a StyledText component that maps from a single semantic element to a set of appropriate styles just doesn't really make sense.

So, StyledText is renamed to LegacyStyledText including at all callsites. The new StyledText requires you to specify styles separately for ODD and Desktop, though it gives you a handy type system integrated hint towards which styles should be allowed. Well, not quite required, more like you have no way to specify both in one prop.

You can view it commit by commit:

  • 07dae4b adds the actual data for the helix product typography styling, and stories for viewing them as design components (and for viewing the old typography styles). This is more or less the only commit there was during the initial review, though it didn't then have the stories for the old typography
  • a36f501 is a repo-wide find and replace to change StyledText to LegacyStyledText
  • acec934 implements the new StyledText.

Stories here: https://s3-us-west-2.amazonaws.com/opentrons-components/EXEC-566-add-helix-product-typography/index.html?path=/docs/design-tokens-typography--docs

Closes EXEC-566

@sfoster1 sfoster1 requested a review from a team as a code owner June 18, 2024 22:11
export const fontSizeDisplayBold = fontSizeDisplay
export const lineHeightDisplayBold = lineHeightDisplay
export const fontFamilyDisplayBold = fontFamilyDisplay
export const fontWeightDisplayBold = '700'
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe define font-weight ?

const regular = 400'
const semiBold = '600'
const bold = '700'

export const fontSizeCaptionMedium = fontSizeCaption
export const lineHeightCaptionMedium = lineHeightCaption
export const fontFamilyCaptionMedium = fontFamilyCaption
export const fontWeightCaptionMedium = '500px'
Copy link
Contributor

Choose a reason for hiding this comment

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

500?

Copy link
Member Author

Choose a reason for hiding this comment

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

whoops

export const fontSizeCaptionRegular = fontSizeCaption
export const lineHeightCaptionRegular = lineHeightCaption
export const fontFamilyCaptionRegular = fontFamilyCaption
export const fontWeightCaptionRegular = '400px'
Copy link
Contributor

Choose a reason for hiding this comment

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

400?

Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops

Copy link
Contributor

@koji koji left a comment

Choose a reason for hiding this comment

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

lgtm!
thank you for adding this!

@sfoster1 sfoster1 requested a review from a team as a code owner June 20, 2024 16:12
@sfoster1 sfoster1 requested a review from koji June 20, 2024 19:48
@sfoster1 sfoster1 force-pushed the EXEC-566-add-helix-product-typography branch from d8d2be7 to acec934 Compare June 20, 2024 19:51
*/

// Valid for most typography styles
export const fontFamily = 'Public Sans'
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use this in app/src/atoms/GlobalStyle/index.ts?

Copy link
Contributor

Choose a reason for hiding this comment

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

use .ts itead of .tsx?

// Code
const fontSizeCode = '0.75rem' // 12px
const lineHeightCode = '1.25rem' // 20px
const fontFamilyCode = 'Reddit Mono'
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use Reddit Mono without installing a package?

Copy link
Member Author

Choose a reason for hiding this comment

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

Definitely not, or at least without installing a font however we install a font - if you look at storybook, this shows up as whatever the browser fallback is. I really haven't investigated how/whether we can isntall this, so I think that if we don't want to keep it as a placeholder I'd rather delete it for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

// Caption
const fontSizeCaption = '0.8125rem' // 13px
const lineHeightCaption = '1rem' // 16px
const fontFamilyCaption = 'Public Sans'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const fontFamilyCaption = 'Public Sans'
const fontFamilyCaption = 'Public Sans'
Suggested change
const fontFamilyCaption = 'Public Sans'
const fontFamilyCaption = fontFamily

export const fontSizeCaptionRegular = fontSizeCaption
export const lineHeightCaptionRegular = lineHeightCaption
export const fontFamilyCaptionRegular = fontFamilyCaption
export const fontWeightCaptionRegular = '400'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export const fontWeightCaptionRegular = '400'
export const fontWeightCaptionRegular = fontWeightRegular

export const fontSizeCaptionMedium = fontSizeCaption
export const lineHeightCaptionMedium = lineHeightCaption
export const fontFamilyCaptionMedium = fontFamilyCaption
export const fontWeightCaptionMedium = '500'
Copy link
Contributor

Choose a reason for hiding this comment

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

nit

maybe define as fontWeightMedium and add it to the top fontWeight group?

then

export const fontWeightCaptionMedium = fontWeightMedium

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not though, fontWeightMedium is 600

Copy link
Member Author

Choose a reason for hiding this comment

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

well, fontWeightSemibold anyway

Copy link
Member Author

Choose a reason for hiding this comment

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

and we got a dqa update to make it 600, so i did this

@sfoster1 sfoster1 force-pushed the EXEC-566-add-helix-product-typography branch from c5f4afe to 32b60f1 Compare June 20, 2024 21:02
- Adds the new sizes for type in the helix product system
- Adds a dummy component under "Design Tokens" in storybook so you can
  view all the text

Closes EXEC-566

Make the storybook display all the stories
LegacyStyledText will use the current styles; a new StyledText
implementation will use the helix design system typography.
StyledText is a component that is only really useful if you're goign to
do semantic styles. Semantic styles are only really useful if they mean
the same thing in all the places they're used. This isn't really true
right now, but we can at least have enumerated style tokens that you can
select from when creating one.

Now, which style token you use is separately selectable across ODD and
non-ODD flows. You can still fully or partially override the CSS if you
want, but the styles on desktop align with helix and the styles on ODD
align with what's going on in ODD.
@sfoster1 sfoster1 force-pushed the EXEC-566-add-helix-product-typography branch from 78614b2 to 051220b Compare June 21, 2024 14:40
Copy link
Collaborator

@jerader jerader left a comment

Choose a reason for hiding this comment

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

very nice 🤩

level1Header: {
as: 'h1',
style: css`
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
Copy link
Collaborator

@jerader jerader Jun 21, 2024

Choose a reason for hiding this comment

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

question, do we need these media queries if these are exclusively for the ODD?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes because the idea is that you will be passing both a desktopStyle and oddStyle to the component, so we want them to work together nicely

@sfoster1 sfoster1 merged commit fec1a98 into edge Jun 21, 2024
25 checks passed
@sfoster1 sfoster1 deleted the EXEC-566-add-helix-product-typography branch June 21, 2024 16:54
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.

None yet

3 participants