Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

add support for prop value in mapToTheme #19

Merged
merged 3 commits into from
May 15, 2019
Merged

add support for prop value in mapToTheme #19

merged 3 commits into from
May 15, 2019

Conversation

mmartinsky
Copy link
Contributor

Closes #17

Allows users to add an optional second argument to mapToTheme, as below:

import styledMap, { mapToTheme as theme } from 'styled-map';

const myTheme = {
  buttonColor: {
    primary: 'orange',
    warning: 'red',
    info: 'blue',
    default: 'white',
  },
  ...
};

const Button = styled.button`
  color: ${theme('buttonColor', 'kind')};
`;

<Button theme={myTheme} kind='warning'>Click</Button> // will be red

@scf4
Copy link
Owner

scf4 commented May 15, 2019

Looks good — I'll review it soon, thanks!

lib/index.js Show resolved Hide resolved
@scf4 scf4 merged commit 040170b into scf4:master May 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to use prop values in mapToTheme
2 participants