Improve styles of onboarding tooltip
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { colors } from '@0xproject/react-shared';
|
||||
import { darken } from 'polished';
|
||||
import { darken, grayscale } from 'polished';
|
||||
import * as React from 'react';
|
||||
import { styled } from 'ts/style/theme';
|
||||
|
||||
@@ -12,32 +12,34 @@ export interface ButtonProps {
|
||||
borderColor?: string;
|
||||
width?: string;
|
||||
type?: string;
|
||||
isDisabled?: boolean;
|
||||
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
||||
}
|
||||
|
||||
const PlainButton: React.StatelessComponent<ButtonProps> = ({ children, onClick, type, className }) => (
|
||||
<button type={type} className={className} onClick={onClick}>
|
||||
const PlainButton: React.StatelessComponent<ButtonProps> = ({ children, isDisabled, onClick, type, className }) => (
|
||||
<button type={type} className={className} onClick={isDisabled ? undefined : onClick}>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
|
||||
export const Button = styled(PlainButton)`
|
||||
cursor: pointer;
|
||||
cursor: ${props => (props.isDisabled ? 'default' : 'pointer')};
|
||||
font-size: ${props => props.fontSize};
|
||||
color: ${props => props.fontColor};
|
||||
transition: background-color 0.5s ease;
|
||||
padding: 0.8em 2.2em;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);
|
||||
font-weight: 500;
|
||||
font-family: ${props => props.fontFamily};
|
||||
width: ${props => props.width};
|
||||
background-color: ${props => props.backgroundColor};
|
||||
background-color: ${props => (props.isDisabled ? grayscale(props.backgroundColor) : props.backgroundColor)};
|
||||
border: ${props => (props.borderColor ? `1px solid ${props.borderColor}` : 'none')};
|
||||
&:hover {
|
||||
background-color: ${props => darken(0.1, props.backgroundColor)};
|
||||
background-color: ${props => (!props.isDisabled ? darken(0.1, props.backgroundColor) : '')};
|
||||
}
|
||||
&:active {
|
||||
background-color: ${props => darken(0.2, props.backgroundColor)};
|
||||
background-color: ${props => (!props.isDisabled ? darken(0.2, props.backgroundColor) : '')};
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -46,6 +48,7 @@ Button.defaultProps = {
|
||||
backgroundColor: colors.white,
|
||||
width: 'auto',
|
||||
fontFamily: 'Roboto',
|
||||
isDisabled: false,
|
||||
};
|
||||
|
||||
Button.displayName = 'Button';
|
||||
|
||||
@@ -16,6 +16,11 @@ export interface ContainerProps {
|
||||
maxWidth?: StringOrNum;
|
||||
isHidden?: boolean;
|
||||
className?: string;
|
||||
position?: 'absolute' | 'fixed' | 'relative' | 'unset';
|
||||
top?: string;
|
||||
left?: string;
|
||||
right?: string;
|
||||
bottom?: string;
|
||||
}
|
||||
|
||||
export const Container: React.StatelessComponent<ContainerProps> = ({ children, className, isHidden, ...style }) => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { colors } from '@0xproject/react-shared';
|
||||
import { Island } from 'ts/components/ui/island';
|
||||
import * as React from 'react';
|
||||
import { styled } from 'ts/style/theme';
|
||||
|
||||
@@ -12,7 +11,7 @@ export interface PointerProps {
|
||||
direction: PointerDirection;
|
||||
}
|
||||
|
||||
const PlainPointer: React.StatelessComponent<PointerProps> = props => <div {...props}/>;
|
||||
const PlainPointer: React.StatelessComponent<PointerProps> = props => <div {...props} />;
|
||||
|
||||
const positionToCss = (props: PointerProps) => {
|
||||
const position = {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { colors } from '@0xproject/react-shared';
|
||||
import { darken } from 'polished';
|
||||
import * as React from 'react';
|
||||
import { styled } from 'ts/style/theme';
|
||||
|
||||
export type TextTag = 'p' | 'div' | 'span' | 'label';
|
||||
export type TextTag = 'p' | 'div' | 'span' | 'label' | 'h1' | 'h2' | 'h3' | 'h4';
|
||||
|
||||
export interface TextProps {
|
||||
className?: string;
|
||||
@@ -14,10 +15,13 @@ export interface TextProps {
|
||||
minHeight?: string;
|
||||
center?: boolean;
|
||||
fontWeight?: number | string;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
const PlainText: React.StatelessComponent<TextProps> = ({ children, className, Tag }) => (
|
||||
<Tag className={className}>{children}</Tag>
|
||||
const PlainText: React.StatelessComponent<TextProps> = ({ children, className, onClick, Tag }) => (
|
||||
<Tag className={className} onClick={onClick}>
|
||||
{children}
|
||||
</Tag>
|
||||
);
|
||||
|
||||
export const Text = styled(PlainText)`
|
||||
@@ -28,14 +32,30 @@ export const Text = styled(PlainText)`
|
||||
${props => (props.center ? 'text-align: center' : '')};
|
||||
color: ${props => props.fontColor};
|
||||
${props => (props.minHeight ? `min-height: ${props.minHeight}` : '')};
|
||||
${props => (props.onClick ? 'cursor: pointer' : '')};
|
||||
transition: color 0.5s ease;
|
||||
&:hover {
|
||||
${props => (props.onClick ? `color: ${darken(0.1, props.fontColor)}` : '')};
|
||||
}
|
||||
`;
|
||||
|
||||
Text.defaultProps = {
|
||||
fontFamily: 'Roboto',
|
||||
fontWeight: 400,
|
||||
fontColor: colors.white,
|
||||
fontColor: colors.black,
|
||||
fontSize: '14px',
|
||||
Tag: 'div',
|
||||
};
|
||||
|
||||
Text.displayName = 'Text';
|
||||
|
||||
export const Title: React.StatelessComponent<TextProps> = props => <Text {...props} />;
|
||||
|
||||
Title.defaultProps = {
|
||||
Tag: 'h2',
|
||||
fontSize: '20px',
|
||||
fontWeight: 600,
|
||||
fontColor: colors.black,
|
||||
};
|
||||
|
||||
Title.displayName = 'Title';
|
||||
|
||||
Reference in New Issue
Block a user