-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTableOfContents.styles.ts
More file actions
141 lines (131 loc) · 3.21 KB
/
Copy pathTableOfContents.styles.ts
File metadata and controls
141 lines (131 loc) · 3.21 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import { animation, colors, spacings } from 'src/atoms/style';
import { VERTICAL_ITEM_HEIGHT } from 'src/organisms/TableOfContents/TableOfContents.constants';
import { motion } from 'motion/react';
import styled, { css } from 'styled-components';
interface ButtonProps {
$active: boolean;
}
export const Button = styled.button<ButtonProps>`
&:hover {
background: ${colors.interactive.primary__hover_alt.rgba};
}
${({ $active }) => {
if ($active) return '';
return css`
&:focus:not(:hover) {
outline: 2px dashed ${colors.interactive.focus.rgba};
outline-offset: -4px;
}
`;
}}
position: relative;
display: grid;
grid-template-columns: auto 1fr;
align-items: center;
gap: ${spacings.small};
color: ${colors.text.static_icons__default.rgba};
cursor: pointer;
padding: 0 ${spacings.medium};
min-height: ${VERTICAL_ITEM_HEIGHT};
transition: background 200ms;
> span {
position: relative;
text-align: left;
font-family: 'Equinor', sans-serif;
font-weight: 700;
font-size: 14px;
}
${({ $active }) => {
return css`
> span {
font-weight: ${$active ? 700 : 500};
&:after {
height: 0;
display: block;
content: attr(title);
font-weight: 700;
font-size: 14px;
overflow: hidden;
visibility: hidden;
}
}
`;
}}
${({ $active }) =>
!$active &&
css`
&:disabled {
color: ${colors.interactive.disabled__text.rgba};
cursor: not-allowed;
}
`}
`;
export const HorizontalItemsContainer = styled.div`
overflow: hidden;
button[role='tab'] {
.count {
background: ${colors.ui.background__light_medium.rgba};
padding: 0 ${spacings.x_small};
> span {
color: ${colors.text.static_icons__tertiary.rgba};
}
}
&:disabled {
.count {
background: ${colors.interactive.disabled__fill.rgba};
> span {
color: ${colors.interactive.disabled__text.rgba};
}
}
}
}
`;
interface VerticalItemsContainerProps {
$activeIndex: number;
$index: number;
}
export const VerticalItemsContainer = styled.div<VerticalItemsContainerProps>`
display: flex;
flex-direction: column;
position: relative;
overflow: hidden;
&:after {
position: absolute;
left: 0;
top: ${({ $activeIndex, $index }) => `${($activeIndex - $index) * 100}%`};
content: '';
width: 2px;
height: 100%;
background: ${colors.interactive.primary__resting.rgba};
z-index: 100;
transition: top ${animation.transitionMS};
}
`;
export const TableOfContentsItemContainer = styled(motion.div)`
display: flex;
flex-direction: column;
position: relative;
min-height: ${VERTICAL_ITEM_HEIGHT};
`;
export const TableOfContentsContainer = styled(motion.div)`
display: flex;
flex-direction: column;
height: fit-content;
overflow: hidden;
&:after {
position: absolute;
left: 0;
content: '';
width: 2px;
height: 100%;
background: ${colors.ui.background__medium.rgba};
}
`;
export const ChildContainer = styled(motion.div)`
display: flex;
flex-direction: column;
> div > button,
a {
padding-left: ${spacings.x_large};
}
`;