/
CardTab.styles.ts
160 lines (146 loc) · 4.88 KB
/
CardTab.styles.ts
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import styled from 'styled-components';
import { macro } from '@synerise/ds-typography';
type CardTabContainerProps = {
active: boolean;
invalid: boolean;
greyBackground: boolean;
color: string;
disabled: boolean;
edited: boolean;
}
const getColor = (isActive: boolean, activeColor: string, defaultColor: string): string => {
if (isActive) return activeColor;
return defaultColor;
};
export const CardTabSuffix = styled.div`
flex-direction: row;
align-items: center;
justify-content: flex-end;
height: 24px;
display: none;
svg {
color: ${({ theme }): string => theme.palette['grey-500']}
fill: ${({ theme }): string => theme.palette['grey-500']}
}
.ds-card-tabs__remove-icon {
svg {
color: ${({ theme }): string => theme.palette['red-600']}
fill: ${({ theme }): string => theme.palette['red-600']}
}
}
`;
export const CardTabLabel = styled.span`
${macro.h300};
color: ${({ theme }): string => theme.palette['grey-600']};
line-height: 20px;
font-size: 14px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
flex: 1;
`;
export const CardTabTag = styled.div`
${macro.h200}
color: ${({ theme }): string => theme.palette.white};
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
border-radius: 3px;
`;
export const CardTabPrefix = styled.div`
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
margin-right: 12px;
`;
export const CardTabContainer = styled.div<CardTabContainerProps>`
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
padding: 12px;
width: 180px;
height: 48px;
user-select: none;
background-color: ${({ theme, active, invalid, color, greyBackground }): string => {
if (invalid && active) return theme.palette['red-600'];
if (active) return theme.palette[color];
if (greyBackground) return theme.palette.white;
return theme.palette['grey-050'];
}};
box-shadow: ${({ greyBackground }): string => (greyBackground ? '0 4px 12px 0 rgba(35, 41, 54, 0.04)' : '0')};
border-radius: 3px;
border-width: 1px;
border-color: ${({ theme, active, invalid, color }): string => {
if (invalid) return theme.palette['red-600'];
return getColor(active, theme.palette[color], theme.palette['grey-050']);
}};
border-style: solid;
pointerEvents: ${({ disabled }): string => (disabled ? 'none' : 'all')};
&:hover {
cursor: pointer;
background-color: ${({ theme, greyBackground }): string =>
greyBackground ? theme.palette.white : theme.palette['grey-050']};
${CardTabSuffix} {
display: flex;
}
${CardTabLabel} {
color: ${({ theme }): string => theme.palette['grey-800']};
}
${CardTabTag} {
background-color: ${({ theme, color }): string => theme.palette[color]}
color: ${({ theme }): string => theme.palette.white};
}
${CardTabPrefix} {
svg {
color: ${({ theme }): string => theme.palette['grey-600']} !important;
fill: ${({ theme }): string => theme.palette['grey-600']} !important;
}
}
.ds-card-tabs__suffix-icon {
svg {
color: ${({ theme }): string => theme.palette['grey-600']}
fill: ${({ theme }): string => theme.palette['grey-600']}
}
}
}
&.pressed {
background-color: ${({ theme }): string => theme.palette['grey-100']};
}
${CardTabTag} {
background-color: ${({ theme, active, color }): string =>
getColor(active, theme.palette.white, theme.palette[color])};
color: ${({ theme, active, color }): string => getColor(active, theme.palette[color], theme.palette.white)};
}
${CardTabLabel} {
color: ${({ theme, active }): string => (active ? theme.palette.white : theme.palette['grey-600'])};
opacity: ${({ disabled }): number => (disabled ? 0.4 : 1)};
}
.ds-card-tabs__suffix-icon {
svg {
color: ${({ theme, active }): string => getColor(active, theme.palette.white, theme.palette['grey-600'])};
fill: ${({ theme, active }): string => getColor(active, theme.palette.white, theme.palette['grey-600'])};
}
opacity: ${({ disabled }): number => (disabled ? 0.4 : 1)};
}
${CardTabPrefix} {
opacity: ${({ disabled }): number => (disabled ? 0.4 : 1)};
.ds-card-tabs__handle-icon {
svg {
color: ${({ theme, active }): string => getColor(active, theme.palette.white, theme.palette['grey-400'])};
fill: ${({ theme, active }): string => getColor(active, theme.palette.white, theme.palette['grey-400'])};
}
}
svg {
color: ${({ theme, active }): string => getColor(active, theme.palette.white, theme.palette['grey-600'])}
fill: ${({ theme, active }): string => getColor(active, theme.palette.white, theme.palette['grey-600'])};
}
${CardTabSuffix} {
opacity: ${({ disabled }): number => (disabled ? 0.4 : 1)};
}
}
`;