Skip to content

Instantly share code, notes, and snippets.

@younesmln
Last active November 1, 2018 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save younesmln/0f2a2de12efd38e83cd9db11e3ca43ce to your computer and use it in GitHub Desktop.
Save younesmln/0f2a2de12efd38e83cd9db11e3ca43ce to your computer and use it in GitHub Desktop.
css in js react native styled component reuse example
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