-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from Teradata/feat/hero-banner
feat(hero-banner): add support for hero banner and typography
- Loading branch information
Showing
8 changed files
with
321 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -10,6 +10,11 @@ const preview: Preview = { | |
date: /Date$/i, | ||
}, | ||
}, | ||
docs: { | ||
source: { | ||
type: 'dynamic', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
|
This file contains 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 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 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
38 changes: 38 additions & 0 deletions
38
libs/react-components/src/lib/components/Typography/Typography.stories.tsx
This file contains 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,38 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import Typography from './index'; | ||
|
||
const meta = { | ||
title: 'Components/Typography', | ||
component: Typography, | ||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs | ||
tags: ['autodocs'], | ||
parameters: { | ||
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout | ||
layout: 'fullscreen', | ||
}, | ||
argTypes: { | ||
scale: { | ||
options: [ | ||
'body1', | ||
'body2', | ||
'body3', | ||
'headline1', | ||
'headline2', | ||
'headline3', | ||
'caption', | ||
'eyebrow', | ||
], | ||
control: { type: 'select' }, | ||
}, | ||
}, | ||
args: { scale: 'headline1' }, | ||
render: (args) => { | ||
return <Typography scale={args.scale}>Change the scale value.</Typography>; | ||
}, | ||
} satisfies Meta<typeof Typography>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = {}; |
29 changes: 29 additions & 0 deletions
29
libs/react-components/src/lib/components/Typography/index.tsx
This file contains 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,29 @@ | ||
import React, { ReactNode } from 'react'; | ||
import styles from './styles.module.scss'; | ||
|
||
interface TypographyProps { | ||
/** | ||
* Scale or type of the text. | ||
*/ | ||
scale: | ||
| 'body1' | ||
| 'body2' | ||
| 'body3' | ||
| 'headline1' | ||
| 'headline2' | ||
| 'headline3' | ||
| 'caption' | ||
| 'eyebrow'; | ||
children?: ReactNode; | ||
} | ||
|
||
const Typography: React.FC<TypographyProps> = ({ | ||
scale = 'body1', | ||
children, | ||
}) => { | ||
return ( | ||
<slot className={`${styles[scale]} ${styles.typography}`}>{children}</slot> | ||
); | ||
}; | ||
|
||
export default Typography; |
136 changes: 136 additions & 0 deletions
136
libs/react-components/src/lib/components/Typography/styles.module.scss
This file contains 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,136 @@ | ||
%headline-styles { | ||
font-style: normal; // Common style | ||
color: var(--td-web-primary-navy); | ||
} | ||
|
||
%body-styles { | ||
font-style: normal; // Common style | ||
color: var(--td-web-gray-700); | ||
} | ||
|
||
.typography { | ||
display: block; | ||
} | ||
|
||
.headline1 { | ||
@extend %headline-styles; | ||
/* Desktop/H1 */ | ||
font-family: var(--td-web-typography-headline1-font-family); | ||
font-size: var(--td-web-typography-headline1-font-size); | ||
font-weight: var(--td-web-typography-headline1-font-weight); | ||
line-height: var(--td-web-typography-headline1-line-height); | ||
letter-spacing: var(--td-web-typography-headline1-letter-spacing); | ||
} | ||
|
||
.headline2 { | ||
@extend %headline-styles; | ||
/* Desktop/H2 */ | ||
font-family: var(--td-web-typography-headline2-font-family); | ||
font-size: var(--td-web-typography-headline2-font-size); | ||
font-weight: var(--td-web-typography-headline2-font-weight); | ||
line-height: var(--td-web-typography-headline2-line-height); | ||
letter-spacing: var(--td-web-typography-headline2-letter-spacing); | ||
} | ||
|
||
.headline3 { | ||
@extend %headline-styles; | ||
/* Desktop/H2 */ | ||
font-family: var(--td-web-typography-headline3-font-family); | ||
font-size: var(--td-web-typography-headline3-font-size); | ||
font-weight: var(--td-web-typography-headline3-font-weight); | ||
line-height: var(--td-web-typography-headline3-line-height); | ||
letter-spacing: var(--td-web-typography-headline3-letter-spacing); | ||
} | ||
|
||
.body1 { | ||
@extend %body-styles; | ||
/* Desktop/Body 1 - Regular */ | ||
font-family: var(--td-web-typography-body-font-family); | ||
font-size: var(--td-web-typography-body1-font-size); | ||
font-weight: var(--td-web-typography-body-font-weight); | ||
line-height: var(--td-web-typography-body1-line-height); | ||
} | ||
|
||
.body2 { | ||
@extend %body-styles; | ||
/* Desktop/Body 2 - Regular */ | ||
font-family: var(--td-web-typography-body-font-family); | ||
font-size: var(--td-web-typography-body2-font-size); | ||
font-weight: var(--td-web-typography-body-font-weight); | ||
line-height: var(--td-web-typography-body2-line-height); | ||
} | ||
|
||
.body3 { | ||
color: var(--td-web-foreground-icon); | ||
/* Desktop/Body 3 - Regular */ | ||
font-family: var(--td-web-typography-body-font-family); | ||
font-size: var(--td-web-typography-body3-font-size); | ||
font-weight: var(--td-web-typography-body-font-weight); | ||
line-height: var(--td-web-typography-body3-line-height); | ||
} | ||
|
||
.caption, | ||
.eyebrow { | ||
@extend %headline-styles; | ||
/* Desktop/Caption/Bold */ | ||
font-family: var(--td-web-typography-caption-font-family); | ||
font-size: var(--td-web-typography-caption-font-size); | ||
font-weight: var(--td-web-typography-caption-font-weight); | ||
line-height: var(--td-web-typography-caption-line-height); | ||
} | ||
|
||
.eyebrow { | ||
align-items: center; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
|
||
&::after { | ||
background-color: var(--cv-theme-tertiary); | ||
border-radius: 2px; | ||
content: ''; | ||
height: 2px; | ||
width: 20px; | ||
} | ||
} | ||
|
||
/* Mobile styles */ | ||
@media only screen and (max-width: 767px) { | ||
.headline1 { | ||
font-size: var(--td-web-typography-headline1-mb-font-size); | ||
line-height: var(--td-web-typography-headline1-mb-line-height); | ||
letter-spacing: var(--td-web-typography-headline1-mb-letter-spacing); | ||
} | ||
|
||
.headline2 { | ||
font-size: calc(var(--td-web-typography-headline3-font-size) + 2px); | ||
line-height: calc(var(--td-web-typography-headline3-line-height) + 2px); | ||
letter-spacing: var(--td-web-typography-headline2-mb-letter-spacing); | ||
} | ||
|
||
.headline3 { | ||
font-size: var(--td-web-typography-body2-font-size); | ||
line-height: var(--td-web-typography-body1-line-height); | ||
} | ||
|
||
.body1 { | ||
font-size: var(--td-web-typography-body2-font-size); | ||
line-height: var(--td-web-typography-body2-line-height); | ||
} | ||
|
||
.body2 { | ||
font-size: var(--td-web-typography-body3-font-size); | ||
line-height: var(--td-web-typography-body3-line-height); | ||
} | ||
|
||
.body3 { | ||
font-size: calc(var(--td-web-typography-body3-font-size) - 2px); | ||
line-height: calc(var(--td-web-typography-body3-line-height) - 2px); | ||
} | ||
|
||
.caption, | ||
.eyebrow { | ||
font-size: calc(var(--td-web-typography-caption-font-size) - 1px); | ||
line-height: calc(var(--td-web-typography-caption-line-height) - 1px); | ||
} | ||
} |
Oops, something went wrong.