-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
232 additions
and
1 deletion.
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 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,59 @@ | ||
@import '../../styles/variables'; | ||
@import '../../styles/colors'; | ||
|
||
$colors: base, error, highlight, lowlight, success, feedback, alert; | ||
$ranges: 100, 200, 300, 400, 500, 600, 700, 800, 900; | ||
|
||
@function set-text-color($color) { | ||
@if (lightness($color) > 50) { | ||
@return font-color(dark); | ||
} @else { | ||
@return font-color(light); | ||
} | ||
} | ||
|
||
@each $color in $colors { | ||
@each $range in $ranges { | ||
.#{$color}#{$range} { | ||
$act-color: palette($color, $range); | ||
|
||
background-color: $act-color; | ||
color: set-text-color($act-color); | ||
|
||
code::after { | ||
content: '#{$act-color}'; | ||
} | ||
|
||
font-weight: 400; | ||
@if $range == 500 { | ||
font-weight: 600; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.wrapper { | ||
width: 300px; | ||
position: relative; | ||
} | ||
|
||
.title { | ||
width: 100%; | ||
text-align: center; | ||
text-transform: capitalize; | ||
margin-bottom: $grid-unit; | ||
} | ||
|
||
.container { | ||
font-size: 15px; | ||
margin-bottom: 4 * $grid-unit; | ||
} | ||
|
||
.color { | ||
height: 5 * $grid-unit; | ||
width: 100%; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding: 0 $grid-unit; | ||
} |
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,47 @@ | ||
import React from 'react' | ||
import cx from 'classnames' | ||
import styles from './Colors.module.scss' | ||
|
||
type ColorNames = | ||
| 'base' | ||
| 'error' | ||
| 'highlight' | ||
| 'lowlight' | ||
| 'success' | ||
| 'feedback' | ||
| 'alert' | ||
|
||
type ColorProps = { | ||
color: ColorNames | ||
range: number | ||
} | ||
function Color({ color, range }: ColorProps) { | ||
return ( | ||
<div className={cx(styles.color, styles[`${color}${range}`])}> | ||
<span>{range === 500 ? color : `${color}-${range}`}</span> | ||
<code /> | ||
</div> | ||
) | ||
} | ||
|
||
type Props = { | ||
color: ColorNames | ||
} | ||
function Colors({ color }: Props) { | ||
const ranges = Array(9) | ||
.fill(0) | ||
.map((_, i) => i * 100 + 100) | ||
|
||
return ( | ||
<div className={styles.wrapper}> | ||
<div className={styles.title}>{color}</div> | ||
<div className={styles.container}> | ||
{ranges.map((range) => ( | ||
<Color color={color} range={range} /> | ||
))} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Colors |
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,36 @@ | ||
@import '../../styles/variables'; | ||
@import '../../styles/colors'; | ||
|
||
$colors: light, highlight, lowlight, regular, grey, dark, disabled; | ||
|
||
@function set-bg-color($color) { | ||
@if (lightness($color) > 20) { | ||
@return palette(base, 900); | ||
} @else { | ||
@return palette(base, 200); | ||
} | ||
} | ||
|
||
@each $color in $colors { | ||
.#{$color} { | ||
$act-color: font-color($color); | ||
|
||
color: $act-color; | ||
background-color: set-bg-color($act-color); | ||
|
||
code::after { | ||
content: '#{$act-color}'; | ||
} | ||
|
||
font-weight: 400; | ||
} | ||
} | ||
|
||
.fontColor { | ||
height: 5 * $grid-unit; | ||
width: 100%; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding: 0 $grid-unit; | ||
} |
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,26 @@ | ||
import React from 'react' | ||
import cx from 'classnames' | ||
import styles from './FontColor.module.scss' | ||
|
||
type ColorNames = | ||
| 'light' | ||
| 'highlight' | ||
| 'lowlight' | ||
| 'regular' | ||
| 'grey' | ||
| 'dark' | ||
| 'disabled' | ||
|
||
type Props = { | ||
color: ColorNames | ||
} | ||
function FontColor({ color }: Props) { | ||
return ( | ||
<div className={cx(styles.fontColor, styles[color])}> | ||
<span>{color}</span> | ||
<code /> | ||
</div> | ||
) | ||
} | ||
|
||
export default FontColor |
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,10 @@ | ||
@import './colors'; | ||
@import '~typeface-montserrat/index.css'; | ||
@import '~typeface-roboto-mono/index.css'; | ||
|
||
@import './variables'; | ||
@import './mixins'; | ||
|
||
* { | ||
font-family: $font-family; | ||
} |