blob: c6a76ff18aa8d0f59e6ecd15076b68ae95402722 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
import { darken } from 'polished';
import * as React from 'react';
import { ColorOption, styled } from '../../style/theme';
export interface TextProps {
fontColor?: ColorOption;
fontFamily?: string;
fontStyle?: string;
fontSize?: string;
opacity?: number;
letterSpacing?: string;
textTransform?: string;
lineHeight?: string;
className?: string;
minHeight?: string;
center?: boolean;
fontWeight?: number | string;
textDecorationLine?: string;
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
noWrap?: boolean;
display?: string;
}
const darkenOnHoverAmount = 0.3;
export const Text =
styled.div <
TextProps >
`
&& {
all: initial;
font-family: 'Inter UI', sans-serif;
font-style: ${props => props.fontStyle};
font-weight: ${props => props.fontWeight};
font-size: ${props => props.fontSize};
opacity: ${props => props.opacity};
text-decoration-line: ${props => props.textDecorationLine};
${props => (props.lineHeight ? `line-height: ${props.lineHeight}` : '')};
${props => (props.center ? 'text-align: center' : '')};
color: ${props => props.fontColor && props.theme[props.fontColor]};
${props => (props.minHeight ? `min-height: ${props.minHeight}` : '')};
${props => (props.onClick ? 'cursor: pointer' : '')};
transition: color 0.5s ease;
${props => (props.noWrap ? 'white-space: nowrap' : '')};
${props => (props.display ? `display: ${props.display}` : '')};
${props => (props.letterSpacing ? `letter-spacing: ${props.letterSpacing}` : '')};
${props => (props.textTransform ? `text-transform: ${props.textTransform}` : '')};
&:hover {
${props =>
props.onClick ? `color: ${darken(darkenOnHoverAmount, props.theme[props.fontColor || 'white'])}` : ''};
}
}
`;
Text.defaultProps = {
fontFamily: 'Inter UI',
fontStyle: 'normal',
fontWeight: 400,
fontColor: ColorOption.black,
fontSize: '15px',
textDecorationLine: 'none',
noWrap: false,
display: 'inline-block',
};
Text.displayName = 'Text';
|