diff --git a/components/Dropdown.js b/components/Dropdown.js index 530cb00..6e180dc 100644 --- a/components/Dropdown.js +++ b/components/Dropdown.js @@ -4,10 +4,10 @@ import ArrowDown from './svg/Arrowdown' import CheckMark from './svg/Checkmark' import { COLORS } from '../lib/constants' -const Dropdown = ({ list, selected, onChange }) => { +const Dropdown = ({ button, color, list, selected, onChange }) => { return ( it === selected)} itemToString={item => item.name} @@ -27,7 +27,7 @@ const reduceState = list => (state, changes) => { } } -const renderDropdown = list => ({ +const renderDropdown = ({ button, color, list, selected }) => ({ isOpen, highlightedIndex, setHighlightedIndex, @@ -39,15 +39,19 @@ const renderDropdown = list => ({ getItemProps }) => { return ( - - + + {selectedItem.name} {isOpen ? ( - + {list.map((item, index) => ( { ) } -const SelectedItem = ({ children, isOpen, ...rest }) => { +const SelectedItem = ({ children, isOpen, color, ...rest }) => { + const itemColor = color || COLORS.SECONDARY + return ( {children}
- +
) } -function minWidth(list) { - return list.reduce((max, { name }) => { - const wordSize = name.length * 12 +function minWidth(isButton, selected, list) { + const items = isButton ? [...list, selected] : list + + return items.reduce((max, { name }) => { + const wordSize = name.length * 10 + 32 return wordSize > max ? wordSize : max }, 0) } diff --git a/components/style/Font.js b/components/style/Font.js index 9094e1e..ced1d96 100644 --- a/components/style/Font.js +++ b/components/style/Font.js @@ -2,43 +2,28 @@ export default () => (