-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
118 lines (100 loc) · 3.3 KB
/
index.tsx
File metadata and controls
118 lines (100 loc) · 3.3 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import styled from 'styled-components'
export const Table = styled.div`
--table-padding-vertical: calc(var(--theme-common-space) * 3);
--table-padding-common: calc(var(--theme-common-space) * 2);
--table-border-radius: ${({ theme: { common } }) => common.borderRadius};
column-gap: calc(var(--theme-common-space) / 2);
display: grid;
min-width: fit-content;
overflow-x: auto;
row-gap: calc(var(--theme-common-space) / 2);
@media (min-width: ${({ theme: { breakPoints } }) => breakPoints.tabletPortraitStart}) {
grid-template-columns: 1fr 1fr;
}
@media (min-width: ${({ theme: { breakPoints } }) => breakPoints.tabletLandscapeStart}) {
grid-template-columns: 1fr 1fr 1fr;
column-gap: var(--theme-common-space);
row-gap: var(--theme-common-space);
}
@media (min-width: ${({ theme: { breakPoints } }) => breakPoints.desktopStart}) {
grid-template-columns: 1fr 1fr 1fr 1fr;
}
@media (min-width: ${({ theme: { breakPoints } }) => breakPoints.desktopWideStart}) {
column-gap: 0;
grid-template-columns: 1fr;
padding-left: var(--table-padding-common);
padding-right: var(--table-padding-common);
row-gap: 0;
}
`
export const TR = styled.div<{ $compact?: boolean }>`
background-color: ${({ theme: { colors } }) => colors.cream};
border: 1px solid ${({ theme: { colors } }) => colors.creamDark};
border-radius: ${({ theme: { common } }) => common.borderRadiusBigger};
cursor: pointer;
display: flex;
flex-direction: column;
flex-wrap: wrap;
min-width: 100%;
padding: var(--table-padding-common);
row-gap: calc(var(--table-padding-common));
transition: none;
&:hover > *:not(:last-child) {
opacity: 0.8;
}
&:active > * {
opacity: 0.5;
}
@media (min-width: ${({ theme: { breakPoints } }) => breakPoints.desktopWideStart}) {
background-color: transparent;
border-left: none;
border-right: none;
border-top: none;
border-radius: 0;
border-right: none;
column-gap: calc(var(--table-padding-common));
display: grid;
grid-template-columns: ${({ $compact }) => {
const addressWidth = 'minmax(185px, 1fr)'
const bridgeDirectionWidth = 'minmax(155px, 1fr)'
const statusWidth = 'minmax(100px, 1fr)'
const baseTemplate = `${addressWidth} ${bridgeDirectionWidth} ${addressWidth} 10px ${addressWidth}`
return $compact ? `${baseTemplate} ${statusWidth}` : `${baseTemplate} 1fr ${statusWidth}`
}};
margin: 0;
padding: 0;
&:last-child {
border-bottom: none;
}
}
`
export const THead = styled(TR)`
border-bottom: none;
display: none;
cursor: default;
@media (min-width: ${({ theme: { breakPoints } }) => breakPoints.desktopWideStart}) {
display: grid;
&:hover,
&:active {
opacity: 1;
}
}
`
export const TD = styled.div`
color: ${({ theme: { colors } }) => colors.primary};
display: flex;
flex-direction: column;
flex-grow: 1;
justify-content: flex-start;
@media (min-width: ${({ theme: { breakPoints } }) => breakPoints.desktopWideStart}) {
padding-bottom: var(--table-padding-vertical);
padding-top: var(--table-padding-vertical);
}
`
export const TH = styled(TD)`
--th-padding-top: calc(var(--theme-common-space) * 4);
font-size: 1.4rem;
font-weight: 400;
padding-top: var(--th-padding-top);
white-space: nowrap;
`