Skip to content

Commit fb78a4a

Browse files
Theme generator - logo props watch mode
1 parent 780d7fe commit fb78a4a

4 files changed

Lines changed: 23 additions & 4 deletions

File tree

src/components/Atomic/Headline/Headline.styles.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,14 @@ export const headline = (theme: ThemeType, type: HeadlineType) => css`
7070
${getSizes(type)};
7171
margin: 0;
7272
`
73+
74+
export const getProps = (theme: { fontSize?: string; fontStyle?: string; fontWeight?: number; lineHeight?: string }) => css`
75+
font-size: ${theme.fontSize};
76+
font-style: ${theme.fontStyle ?? 'normal'};
77+
font-weight: ${theme.fontWeight};
78+
line-height: ${theme.lineHeight};
79+
`
80+
81+
export const h6 = (theme: ThemeType) => css`
82+
${getProps(get(theme, `Headline.sizes.h6`))};
83+
`

src/components/Atomic/Headline/Headline.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ const Headline: FC<Props> = (props) => {
88
const mergedProps = { ...defaultProps, ...props }
99
const HeadlineElement = ({ type, children, ...props }: Props) => createElement(type as string, props, children)
1010

11-
const { dataTestId, className, ...rest } = mergedProps
11+
const { dataTestId, className, type, ...rest } = mergedProps
1212

1313
return (
1414
<HeadlineElement
1515
{...rest}
1616
children={mergedProps.children}
1717
className={classNames(mergedProps.type, className)}
18-
css={[(theme) => styles.headline(theme, mergedProps.type!)]}
18+
css={(theme) => [styles.headline(theme, mergedProps.type!), mergedProps.type === 'h6' && styles.h6(theme)]}
1919
data-test-id={mergedProps.dataTestId}
20+
type={mergedProps.type}
2021
/>
2122
)
2223
}

src/components/Atomic/Headline/Headline.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ReactNode } from 'react'
22

3-
export type HeadlineType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5'
3+
export type HeadlineType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
44

55
export type Props = {
66
className?: string

src/components/Atomic/_theme/template.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,14 @@ export const getThemeTemplate = (colors: any, logoProps: LogoType) => ({
410410
borderBottom: colors.neutral200,
411411
},
412412
Headline: {
413-
color: colors.neutral900,
413+
color: colors.primaryDarken,
414+
sizes: {
415+
h6: {
416+
fontSize: '14px',
417+
lineHeight: '16px',
418+
fontWeight: 600,
419+
},
420+
},
414421
},
415422
Layout: {
416423
background: colors.neutral000,

0 commit comments

Comments
 (0)