-
Notifications
You must be signed in to change notification settings - Fork 0
/
'
104 lines (96 loc) · 2.57 KB
/
'
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import React from 'react'
import styled from 'styled-components'
import { colors } from './styles.ts'
const crossSize = 16
const Cross = styled.div`
position: absolute;
left: 50%;
top: 25%;
width: ${crossSize}px;
height: ${crossSize}px;
:before,
:after {
position: absolute;
left: 0;
content: '';
height: ${crossSize}px;
width: 2px;
background-color: ${colors.PrimaryColor};
}
:before {
transform: rotate(90deg);
}
:after {
transform: rotate(180deg);
}
`
//0 0 15px 15px
const Wrapper = styled.button`
height: 35px;
border-radius: ${(props: IButtonProps) => (props.borderVariant == ButtonBorderTypes.rounded ? '4px' :
props.size == ButtonBorderTypes.topflat ? '0 0 15px 15px' : '0 0 15px 15px')};
outline: none;
border: 1px solid ${colors.TertiaryColor};
position: relative;
cursor: pointer;
background-color: ${(props: IButtonProps) => (props.backgroundVariant == ButtonBackgroundTypes.light ? colors.WhiteColor :
props.backgroundVariant == ButtonBackgroundTypes.dark ? colors.PrimaryColor : colors.PrimaryColor)};
:hover {
background-color: 1px dashed ${colors.SecondaryColor};
}
:hover ${Cross}:before {
background-color: ${colors.TertiaryColor};
}
:hover ${Cross}:after {
background-color: ${colors.TertiaryColor};
}
`
//const Wrapper = styled.div`
// background-color: ${colors.primaryColor};
// border: 2px solid ${colors.primaryColor};
// border-radius: 4px;
// display: flex;
// justify-content: center;
// align-items: center;
// :hover {
// cursor: pointer;
// }
//`
const Text = styled.span`
font-size: 14px;
text-align: center;
padding: ${(props: IButtonProps) => (props.size == 'small' ? '3px 10px' :
props.size == 'big' ? '10px 15px' : '10px 15px')};
`
export enum ButtonBackgroundTypes {
light,
dark,
warning
}
export enum ButtonBorderTypes {
topflat,
rounded
}
//modification outline inverted notext
interface IButtonProps {
backgroundVariant?: ButtonBackgroundTypes
borderVariant?: ButtonBorderTypes
modification?: string
name: string
onClick?: () => void
size?: string
}
const Button: React.FC<IButtonProps> = props => {
const { modification, name, onClick, size } = props
return (
<Wrapper { ...props } >
{ modification != 'notext' && <Text {...props}>{name}</Text>}
{ modification == 'notext' && <Cross />}
</Wrapper>
)
}
Button.defaultProps = {
backgroundVariant: ButtonBackgroundTypes.dark,
borderVariant: ButtonBorderTypes.rounded
}
export default React.memo(Button)