-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core-components-typography): add responsive title (#362)
* style(core-components-typography): rename to lower case * feat(core-components-typography): add title responsive * docs(core-components-typography): add todo * feat(core-components-typography): add styles
- Loading branch information
Showing
17 changed files
with
247 additions
and
35 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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { FC } from 'react'; | ||
|
||
import { Title, TitleProps } from './title'; | ||
import { Text, TextProps } from './text'; | ||
import { TitleResponsive } from './title-responsive'; | ||
|
||
export const Typography: { | ||
Title: FC<TitleProps>; | ||
Text: FC<TextProps>; | ||
TitleResponsive: FC<TitleProps>; | ||
} = { | ||
Title, | ||
Text, | ||
TitleResponsive, | ||
}; |
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 |
---|---|---|
@@ -1 +1 @@ | ||
export * from './Component'; | ||
export * from './component'; |
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1 +1 @@ | ||
export * from './Component'; | ||
export * from './component'; |
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,14 @@ | ||
import React, { FC } from 'react'; | ||
|
||
import { TitleProps, Title } from '../title/component'; | ||
|
||
import styles from './index.module.css'; | ||
import commonStyles from '../title/common.module.css'; | ||
|
||
export const TitleResponsive: FC<TitleProps> = props => { | ||
/** | ||
* Если поменять Object.assign на деструктуризацию, то упадут тесты. | ||
* Видимо, это особенность работы jest и css-modules. | ||
*/ | ||
return <Title {...props} styles={Object.assign(styles, commonStyles)} />; | ||
}; |
127 changes: 127 additions & 0 deletions
127
packages/typography/src/title-responsive/index.module.css
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,127 @@ | ||
@import '../../../themes/src/default.css'; | ||
|
||
/* TODO: поменять медиа-запросы на миксины */ | ||
|
||
.styrene-xlarge { | ||
@mixin headline_medium; | ||
} | ||
|
||
.styrene-large { | ||
@mixin headline_small; | ||
} | ||
|
||
.styrene-medium { | ||
@mixin headline_xsmall; | ||
} | ||
|
||
.styrene-small { | ||
@mixin headline_xsmall; | ||
} | ||
|
||
.styrene-xsmall { | ||
@mixin headline_xsmall; | ||
} | ||
|
||
.system-xlarge { | ||
@mixin headline-system_medium; | ||
} | ||
|
||
.system-large { | ||
@mixin headline-system_small; | ||
} | ||
|
||
.system-medium { | ||
@mixin headline-system_xsmall; | ||
} | ||
|
||
.system-small { | ||
@mixin headline-system_xsmall; | ||
} | ||
|
||
.system-xsmall { | ||
@mixin headline-system_xsmall; | ||
} | ||
|
||
@media screen and (min-width: 600px) { | ||
.styrene-xlarge { | ||
@mixin headline_large; | ||
} | ||
|
||
.styrene-large { | ||
@mixin headline_medium; | ||
} | ||
|
||
.styrene-medium { | ||
@mixin headline_small; | ||
} | ||
|
||
.styrene-small { | ||
@mixin headline_small; | ||
} | ||
|
||
.styrene-xsmall { | ||
@mixin headline_xsmall; | ||
} | ||
|
||
.system-xlarge { | ||
@mixin headline-system_large; | ||
} | ||
|
||
.system-large { | ||
@mixin headline-system_medium; | ||
} | ||
|
||
.system-medium { | ||
@mixin headline-system_small; | ||
} | ||
|
||
.system-small { | ||
@mixin headline-system_small; | ||
} | ||
|
||
.system-xsmall { | ||
@mixin headline-system_xsmall; | ||
} | ||
} | ||
|
||
@media screen and (min-width: 1024px) { | ||
.styrene-xlarge { | ||
@mixin headline_xlarge; | ||
} | ||
|
||
.styrene-large { | ||
@mixin headline_large; | ||
} | ||
|
||
.styrene-medium { | ||
@mixin headline_medium; | ||
} | ||
|
||
.styrene-small { | ||
@mixin headline_small; | ||
} | ||
|
||
.styrene-xsmall { | ||
@mixin headline_xsmall; | ||
} | ||
|
||
.system-xlarge { | ||
@mixin headline-system_xlarge; | ||
} | ||
|
||
.system-large { | ||
@mixin headline-system_large; | ||
} | ||
|
||
.system-medium { | ||
@mixin headline-system_medium; | ||
} | ||
|
||
.system-small { | ||
@mixin headline-system_small; | ||
} | ||
|
||
.system-xsmall { | ||
@mixin headline-system_xsmall; | ||
} | ||
} |
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 @@ | ||
export * from './component'; |
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,16 @@ | ||
.component { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.bold { | ||
font-weight: bold; | ||
} | ||
|
||
.medium { | ||
font-weight: 500; | ||
} | ||
|
||
.regular { | ||
font-weight: normal; | ||
} |
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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,16 @@ | ||
import React, { FC } from 'react'; | ||
|
||
import { Title as TitleBase, TitleProps } from './component'; | ||
|
||
import styles from './index.module.css'; | ||
import commonStyles from './common.module.css'; | ||
|
||
const Title: FC<TitleProps> = props => { | ||
/** | ||
* Если поменять Object.assign на деструктуризацию, то упадут тесты. | ||
* Видимо, это особенность работы jest и css-modules. | ||
*/ | ||
return <TitleBase {...props} styles={Object.assign(styles, commonStyles)} />; | ||
}; | ||
|
||
export { Title, TitleProps }; |