Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Commit

Permalink
Add ability to specify font weight from theme for the fontWeight prop
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Nov 13, 2018
1 parent 065353e commit c99d29c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/_utils/reakitTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ const buildFontSizeFromTheme = (property, { theme, ...props }) => {
return `${property}: ${size}em !important;`;
};

const buildFontWeightFromTheme = (property, { theme, ...props }) => {
let weight = theme.fannypack.fontWeights[props[_camelCase(property)]];
if (!weight) return;
return `${property}: ${weight} !important;`;
};

export default {
Box: css`
/* If the color is one from the palette, use it. E.g. background-color="primary" */
Expand Down Expand Up @@ -55,5 +61,7 @@ export default {
${props => buildSpacingFromTheme('padding-bottom', props)};
${props => buildFontSizeFromTheme('font-size', props)};
${props => buildFontWeightFromTheme('font-weight', props)};
`
};

0 comments on commit c99d29c

Please sign in to comment.