Last active
November 1, 2018 09:18
-
-
Save younesmln/0f2a2de12efd38e83cd9db11e3ca43ce to your computer and use it in GitHub Desktop.
css in js react native styled component reuse example
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
const pickFontWeight = ( | |
fontWeight: 'bold' | 'light', | |
{ fontFamilies }: Theme, | |
) => { | |
switch (fontWeight) { | |
case 'bold': | |
return css` | |
font-family: ${fontFamilies.boldFont}; | |
font-weight: bold; | |
`; | |
case 'light': | |
return css` | |
font-family: ${fontFamilies.lightFont}; | |
font-weight: 300; | |
`; | |
default: | |
return css` | |
font-family: ${fontFamilies.lightFont}; | |
font-weight: normal; | |
`; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment