diff options
author | Steve Klebanoff <steve@0xproject.com> | 2019-01-04 01:07:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-04 01:07:57 +0800 |
commit | 2111ea159e48206a63f311dfc1ed56a3925603c7 (patch) | |
tree | 57e8782829590128e397ac45d9e905cab6a5f22b /packages | |
parent | c1150824dc0019da72d1a78586d1ba722626c78c (diff) | |
parent | c62d862967a3c90e903e016fae2456afb2f9d8f9 (diff) | |
download | dexon-0x-contracts-2111ea159e48206a63f311dfc1ed56a3925603c7.tar.gz dexon-0x-contracts-2111ea159e48206a63f311dfc1ed56a3925603c7.tar.zst dexon-0x-contracts-2111ea159e48206a63f311dfc1ed56a3925603c7.zip |
Merge pull request #1481 from 0xProject/fix/instant/dropdown-color
[instant] Dropdown hover 10% of primary color
Diffstat (limited to 'packages')
-rw-r--r-- | packages/instant/src/components/ui/container.tsx | 2 | ||||
-rw-r--r-- | packages/instant/src/components/ui/dropdown.tsx | 39 |
2 files changed, 24 insertions, 17 deletions
diff --git a/packages/instant/src/components/ui/container.tsx b/packages/instant/src/components/ui/container.tsx index 636eb8fc9..58d7d5871 100644 --- a/packages/instant/src/components/ui/container.tsx +++ b/packages/instant/src/components/ui/container.tsx @@ -36,6 +36,7 @@ export interface ContainerProps { cursor?: string; overflow?: string; darkenOnHover?: boolean; + rawHoverColor?: string; boxShadowOnHover?: boolean; flexGrow?: string | number; } @@ -87,6 +88,7 @@ export const Container = background-color: ${props => getBackgroundColor(props.theme, props.backgroundColor, props.rawBackgroundColor)}; border-color: ${props => (props.borderColor ? props.theme[props.borderColor] : 'none')}; &:hover { + ${props => (props.rawHoverColor ? `background-color: ${props.rawHoverColor}` : '')} ${props => props.darkenOnHover ? `background-color: ${ diff --git a/packages/instant/src/components/ui/dropdown.tsx b/packages/instant/src/components/ui/dropdown.tsx index 93ad06aee..8788d3d59 100644 --- a/packages/instant/src/components/ui/dropdown.tsx +++ b/packages/instant/src/components/ui/dropdown.tsx @@ -1,7 +1,8 @@ import * as _ from 'lodash'; +import { transparentize } from 'polished'; import * as React from 'react'; -import { ColorOption, completelyTransparent } from '../../style/theme'; +import { ColorOption, completelyTransparent, ThemeConsumer } from '../../style/theme'; import { zIndex } from '../../style/z_index'; import { Container } from './container'; @@ -121,22 +122,26 @@ export interface DropdownItemProps extends DropdownItemConfig { } export const DropdownItem: React.StatelessComponent<DropdownItemProps> = ({ text, onClick, isLast }) => ( - <Container - onClick={onClick} - cursor="pointer" - darkenOnHover={true} - backgroundColor={ColorOption.white} - padding="0.8em" - borderTop="0" - border="1px solid" - borderRadius={isLast ? '0px 0px 4px 4px' : undefined} - width="100%" - borderColor={ColorOption.feintGrey} - > - <Text fontSize="14px" fontColor={ColorOption.darkGrey}> - {text} - </Text> - </Container> + <ThemeConsumer> + {theme => ( + <Container + onClick={onClick} + cursor="pointer" + rawHoverColor={transparentize(0.9, theme[ColorOption.primaryColor])} + backgroundColor={ColorOption.white} + padding="0.8em" + borderTop="0" + border="1px solid" + borderRadius={isLast ? '0px 0px 4px 4px' : undefined} + width="100%" + borderColor={ColorOption.feintGrey} + > + <Text fontSize="14px" fontColor={ColorOption.darkGrey}> + {text} + </Text> + </Container> + )} + </ThemeConsumer> ); DropdownItem.displayName = 'DropdownItem'; |