-
Notifications
You must be signed in to change notification settings - Fork 1
IBX-7843: Typography #25
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
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| @use 'variables' as *; | ||
|
|
||
| .ids-link { | ||
| font-family: $font-family-alt; | ||
| text-decoration: underline; | ||
| color: $color-neutral-240; | ||
GrabowskiM marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import React from 'react'; | ||
|
|
||
| import type { Meta, StoryObj } from '@storybook/react'; | ||
|
|
||
| import TypographyBase from './TypographyBase'; | ||
| import TypographyHeaders from './TypographyHeaders'; | ||
| import TypographyLinks from './TypographyLinks'; | ||
|
|
||
| import './typography.styles.scss'; | ||
|
|
||
| const Typography = () => { | ||
| return ( | ||
| <div className="dev-typography-container"> | ||
| <TypographyHeaders /> | ||
| <TypographyBase /> | ||
| <TypographyLinks /> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| const meta: Meta<typeof Typography> = { | ||
| component: Typography, | ||
| parameters: { | ||
| layout: 'padded', | ||
| }, | ||
| tags: [], | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof Typography>; | ||
|
|
||
| export const Default: Story = { | ||
| name: 'Default', | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| import React from 'react'; | ||
|
|
||
| const TypographyBase = () => { | ||
| const sentence = 'The quick brown fox jumps over the lazy dog'; | ||
| const fontSizesBase = [ | ||
| { lineHeight: 30, name: '2xl', size: 20 }, | ||
| { lineHeight: 28, name: 'xl', size: 18 }, | ||
| { lineHeight: 24, name: 'l', size: 16 }, | ||
| { lineHeight: 21, name: 'm', size: 14 }, | ||
| { lineHeight: 18, name: 's', size: 12 }, | ||
| { lineHeight: 15, name: 'xs', size: 10 }, | ||
| ]; | ||
| const fontSizesHighlighted = [ | ||
| { lineHeight: 36, name: '3xl', size: 24 }, | ||
| { lineHeight: 30, name: '2xl', size: 20 }, | ||
| { lineHeight: 28, name: 'xl', size: 18 }, | ||
| { lineHeight: 24, name: 'l', size: 16 }, | ||
| { lineHeight: 21, name: 'm', size: 14 }, | ||
| { lineHeight: 18, name: 's', size: 12 }, | ||
| ]; | ||
| const fontWeights = [ | ||
| { name: 'normal', weight: '400' }, | ||
| { name: 'semi', weight: '600' }, | ||
| ]; | ||
| const fontStyles = [ | ||
| { name: 'normal', style: 'normal' }, | ||
| { name: 'italic', style: 'italic' }, | ||
| ]; | ||
| const renderRow = (className: string, name: string, style: string, weight: string, size: number, lineHeight: number) => { | ||
| return ( | ||
| <tr className="ids-table__row" key={className}> | ||
| <td className="ids-table__cell"> | ||
| <span className={className}>{sentence}</span> | ||
| </td> | ||
| <td className="ids-table__cell">{name}</td> | ||
| <td className="ids-table__cell">{style}</td> | ||
| <td className="ids-table__cell">{weight}</td> | ||
| <td className="ids-table__cell">{size}px</td> | ||
| <td className="ids-table__cell">{lineHeight}px</td> | ||
| </tr> | ||
| ); | ||
| }; | ||
|
|
||
| return ( | ||
| <table className="ids-table"> | ||
| <caption className="ids-table__caption">Base font</caption> | ||
| <thead className="ids-table__header"> | ||
| <tr className="ids-table__row"> | ||
| <th className="ids-table__header-cell">Sentence</th> | ||
| <th className="ids-table__header-cell">Name</th> | ||
| <th className="ids-table__header-cell">Style</th> | ||
| <th className="ids-table__header-cell">Weight</th> | ||
| <th className="ids-table__header-cell">Size</th> | ||
| <th className="ids-table__header-cell">Line-height</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody className="ids-table__body"> | ||
| {fontWeights.map(({ name: weightName, weight }) => { | ||
| return fontStyles.map(({ name: styleName, style }) => { | ||
| return fontSizesBase.map(({ name: sizeName, size, lineHeight }) => { | ||
| return renderRow(`base-${sizeName}-${weightName}-${styleName}`, 'Noto sans', style, weight, size, lineHeight); | ||
| }); | ||
| }); | ||
| })} | ||
| {fontWeights.map(({ name: weightName, weight }) => { | ||
| return fontSizesHighlighted.map(({ name: sizeName, size, lineHeight }) => { | ||
| return renderRow(`base-${sizeName}-${weightName}-normal`, 'Work sans', 'normal', weight, size, lineHeight); | ||
| }); | ||
| })} | ||
| </tbody> | ||
| </table> | ||
| ); | ||
| }; | ||
|
|
||
| export default TypographyBase; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import React from 'react'; | ||
|
|
||
| const TypographyHeaders = () => { | ||
| const sentence = 'The quick brown fox jumps over the lazy dog'; | ||
| const headers = [ | ||
| { content: <h1>{sentence}</h1>, lineHeight: 36, name: 'h1', size: 24 }, | ||
| { content: <h2>{sentence}</h2>, lineHeight: 30, name: 'h2', size: 20 }, | ||
| { content: <h3>{sentence}</h3>, lineHeight: 28, name: 'h3', size: 18 }, | ||
| { content: <h4>{sentence}</h4>, lineHeight: 24, name: 'h4', size: 16 }, | ||
| { content: <h5>{sentence}</h5>, lineHeight: 21, name: 'h5', size: 14 }, | ||
| { content: <h6>{sentence}</h6>, lineHeight: 18, name: 'h6', size: 12 }, | ||
| ]; | ||
|
|
||
| return ( | ||
| <table className="ids-table"> | ||
| <caption className="ids-table__caption">Header</caption> | ||
| <thead className="ids-table__header"> | ||
| <tr className="ids-table__row"> | ||
| <th className="ids-table__header-cell">Sentence</th> | ||
| <th className="ids-table__header-cell">Tag</th> | ||
| <th className="ids-table__header-cell">Name</th> | ||
| <th className="ids-table__header-cell">Style</th> | ||
| <th className="ids-table__header-cell">Weight</th> | ||
| <th className="ids-table__header-cell">Size</th> | ||
| <th className="ids-table__header-cell">Line-height</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody className="ids-table__body"> | ||
| {headers.map(({ name, content, size, lineHeight }) => { | ||
| return ( | ||
| <tr className="ids-table__row" key={name}> | ||
| <td className="ids-table__cell">{content}</td> | ||
| <td className="ids-table__cell">{name}</td> | ||
| <td className="ids-table__cell">Work sans</td> | ||
| <td className="ids-table__cell">normal</td> | ||
| <td className="ids-table__cell">semi-bold</td> | ||
| <td className="ids-table__cell">{size}px</td> | ||
| <td className="ids-table__cell">{lineHeight}px</td> | ||
| </tr> | ||
| ); | ||
| })} | ||
| </tbody> | ||
| </table> | ||
| ); | ||
| }; | ||
|
|
||
| export default TypographyHeaders; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import React from 'react'; | ||
|
|
||
| const TypographyLinks = () => { | ||
| const sentence = 'The quick brown fox jumps over the lazy dog'; | ||
| const fontSizesLinks = [ | ||
| { lineHeight: 24, name: 'l', size: 16 }, | ||
| { lineHeight: 21, name: 'm', size: 14 }, | ||
| { lineHeight: 18, name: 's', size: 12 }, | ||
| { lineHeight: 15, name: 'xs', size: 10 }, | ||
| ]; | ||
| const fontWeights = [ | ||
| { name: 'normal', weight: '400' }, | ||
| { name: 'semi', weight: '600' }, | ||
| ]; | ||
|
|
||
| return ( | ||
| <table className="ids-table"> | ||
| <caption className="ids-table__caption">Header</caption> | ||
| <thead className="ids-table__header"> | ||
| <tr className="ids-table__row"> | ||
| <th className="ids-table__header-cell">Sentence</th> | ||
| <th className="ids-table__header-cell">Name</th> | ||
| <th className="ids-table__header-cell">Style</th> | ||
| <th className="ids-table__header-cell">Weight</th> | ||
| <th className="ids-table__header-cell">Size</th> | ||
| <th className="ids-table__header-cell">Line-height</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody className="ids-table__body"> | ||
| {fontWeights.map(({ name: weightName, weight }) => { | ||
| return fontSizesLinks.map(({ name: sizeName, size, lineHeight }) => { | ||
| const className = `link-${sizeName}-${weightName} ids-link`; | ||
|
|
||
| return ( | ||
| <tr className="ids-table__row" key={className}> | ||
| <td className="ids-table__cell"> | ||
| <a className={className} href="#"> | ||
| {sentence} | ||
| </a> | ||
| </td> | ||
| <td className="ids-table__cell">Work sans</td> | ||
| <td className="ids-table__cell">normal</td> | ||
| <td className="ids-table__cell">{weight}</td> | ||
| <td className="ids-table__cell">{size}px</td> | ||
| <td className="ids-table__cell">{lineHeight}px</td> | ||
| </tr> | ||
| ); | ||
| }); | ||
| })} | ||
| </tbody> | ||
| </table> | ||
| ); | ||
| }; | ||
|
|
||
| export default TypographyLinks; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| @use '../../packages/assets/src/scss/functions/calculate.rem' as *; | ||
| @use '../../packages/assets/src/scss/variables/colors' as *; | ||
| @use '../../packages/assets/src/scss/variables/typography' as *; | ||
|
|
||
| $font-sizes-base: ( | ||
| '2xl': $text-font-size-2xl, | ||
| 'xl': $text-font-size-xl, | ||
| 'l': $text-font-size-l, | ||
| 'm': $text-font-size-m, | ||
| 's': $text-font-size-s, | ||
| 'xs': $text-font-size-xs | ||
| ); | ||
| $font-sizes-highlighted: ( | ||
| '3xl': $text-font-size-3xl, | ||
| '2xl': $text-font-size-2xl, | ||
| 'xl': $text-font-size-xl, | ||
| 'l': $text-font-size-l, | ||
| 'm': $text-font-size-m, | ||
| 's': $text-font-size-s | ||
| ); | ||
| $font-sizes-links: ( | ||
| 'l': $text-font-size-l, | ||
| 'm': $text-font-size-m, | ||
| 's': $text-font-size-s, | ||
| 'xs': $text-font-size-xs | ||
| ); | ||
| $font-weights: ( | ||
| 'normal': $text-font-weight-normal, | ||
| 'semi': $text-font-weight-semi | ||
| ); | ||
| $font-styles: ( | ||
| 'normal': normal, | ||
| 'italic': italic | ||
| ); | ||
|
|
||
| .dev-typography-container { | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| gap: calculateRem(32px); | ||
|
|
||
| .ids-table, | ||
| .ids-table .ids-table__header-cell, | ||
| .ids-table .ids-table__cell { | ||
| border: calculateRem(1px) solid $color-neutral-240; | ||
| } | ||
|
|
||
| .ids-table .ids-table__header-cell, | ||
| .ids-table .ids-table__cell { | ||
| padding: calculateRem(4px) calculateRem(16px); | ||
| } | ||
|
|
||
| .ids-table .ids-table__caption { | ||
| caption-side: top; | ||
| font-size: $text-font-size-2xl; | ||
| font-weight: $text-font-weight-semi; | ||
| } | ||
|
|
||
| @each $weight-name, $weight in $font-weights { | ||
| @each $style-name, $style in $font-styles { | ||
| @each $size-name, $size in $font-sizes-base { | ||
| .base-#{$size-name}-#{$weight-name}-#{$style-name} { | ||
| font-size: $size; | ||
| font-weight: $weight; | ||
| font-style: $style; | ||
| font-family: $font-family; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @each $weight-name, $weight in $font-weights { | ||
| @each $size-name, $size in $font-sizes-highlighted { | ||
| .base-#{$size-name}-#{$weight-name}-normal { | ||
| font-size: $size; | ||
| font-weight: $weight; | ||
| font-style: normal; | ||
| font-family: $font-family-alt; | ||
GrabowskiM marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| @each $weight-name, $weight in $font-weights { | ||
| @each $size-name, $size in $font-sizes-links { | ||
| .link-#{$size-name}-#{$weight-name} { | ||
| font-size: $size; | ||
| font-weight: $weight; | ||
| font-family: $font-family-alt; | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.