From af3a2d92e3fecd8bca1089ece768a1844f9bf480 Mon Sep 17 00:00:00 2001 From: Kyle Suss Date: Wed, 26 Jun 2019 11:24:02 -0600 Subject: [PATCH] Update form components to support secondary styling --- src/components/Checkbox.js | 15 ++++++++++----- src/components/Checkbox.stories.js | 8 ++++++++ src/components/Radio.js | 25 ++++++++++++++++++++----- src/components/Radio.stories.js | 9 +++++++++ src/components/Select.js | 3 +++ src/components/Textarea.js | 2 +- 6 files changed, 51 insertions(+), 11 deletions(-) diff --git a/src/components/Checkbox.js b/src/components/Checkbox.js index 479ab512..6e56454f 100644 --- a/src/components/Checkbox.js +++ b/src/components/Checkbox.js @@ -75,15 +75,16 @@ const Input = styled.input.attrs({ type: 'checkbox' })` } &:focus + ${LabelText}:before { - box-shadow: ${color.primary} 0 0 0 1px inset; + box-shadow: ${props => props.checkboxColor} 0 0 0 1px inset; } &:checked + ${LabelText}:before { - box-shadow: ${color.primary} 0 0 0 1px inset; + box-shadow: ${props => props.checkboxColor} 0 0 0 1px inset; } &:checked:focus + ${LabelText}:before { - box-shadow: ${color.primary} 0 0 0 1px inset, ${rgba(color.primary, 0.3)} 0 0 5px 2px; + box-shadow: ${props => props.checkboxColor} 0 0 0 1px inset, + ${props => rgba(props.checkboxColor, 0.3)} 0 0 5px 2px; } & + ${LabelText}:after { @@ -100,7 +101,7 @@ const Input = styled.input.attrs({ type: 'checkbox' })` &:checked + ${LabelText}:after { transform: scale3d(1, 1, 1); - background: ${color.primary}; + background: ${props => props.checkboxColor}; opacity: 1; } `; @@ -111,8 +112,9 @@ const CheckboxWrapper = styled.div` flex-wrap: wrap; `; -export function Checkbox({ id, label, error, hideLabel, ...props }) { +export function Checkbox({ appearance, id, label, error, hideLabel, ...props }) { const errorId = `${id}-error`; + const checkboxColor = color[appearance]; return (