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

Commit

Permalink
Merge pull request #1481 from 0xProject/fix/instant/dropdown-color
Browse files Browse the repository at this point in the history
[instant] Dropdown hover 10% of primary color
  • Loading branch information
Steve Klebanoff authored Jan 3, 2019
2 parents c115082 + c62d862 commit 2111ea1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
2 changes: 2 additions & 0 deletions packages/instant/src/components/ui/container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface ContainerProps {
cursor?: string;
overflow?: string;
darkenOnHover?: boolean;
rawHoverColor?: string;
boxShadowOnHover?: boolean;
flexGrow?: string | number;
}
Expand Down Expand Up @@ -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: ${
Expand Down
39 changes: 22 additions & 17 deletions packages/instant/src/components/ui/dropdown.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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';

0 comments on commit 2111ea1

Please sign in to comment.