Skip to content

Commit d62bc3d

Browse files
committed
Add theming to timeline and taskview
1 parent 3e02994 commit d62bc3d

File tree

10 files changed

+73
-20
lines changed

10 files changed

+73
-20
lines changed

src/components/Timeline/Footer/MinimapActiveSection.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const MinimapActiveSection: React.FC<ActiveSectionProps> = ({ timeline, dragging
6161
const MiniTimelineActiveSection = styled.div<{ dragging: boolean }>`
6262
position: relative;
6363
height: 3.0625rem;
64-
background var(--color-bg-primary);
64+
background var(--timeline-footer-selected-bg);
6565
border-left: var(--border-thin-1);
6666
border-right: var(--border-thin-1);
6767
border-bottom: 0.5rem solid var(--color-border-1);

src/components/Timeline/Footer/MinimapFooter.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ const MinimapFooter: React.FC<MinimapFooterProps> = ({
186186
const MinimapFooterContent = styled.div`
187187
position: relative;
188188
flex: 1;
189-
background: var(--color-bg-secondary);
189+
background: var(--timeline-footer-bg);
190190
border-bottom: var(--border-thin-1);
191191
height: 3.0625rem;
192192
`;

src/components/Timeline/Footer/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const TimelineFooterContainer = styled.div`
3434
width: 100%;
3535
height: 2.5rem;
3636
margin-bottom: 1.5625rem;
37-
border-top: var(--border-medium-1);
37+
border-top: var(--timeline-footer-border);
3838
`;
3939

4040
const TimelineFooterLeft = styled.div`

src/components/Timeline/TaskListLabel.tsx

+10-5
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,20 @@ const RowLabel = styled.div<{ type: 'step' | 'task'; isOpen?: boolean; group?: b
125125
max-width: 15.3125rem;
126126
overflow: hidden;
127127
cursor: pointer;
128-
font-size: ${(p) => (p.type === 'task' ? '0.75rem' : '0.875rem')};
129-
font-weight: ${(p) => (p.type === 'step' ? '600' : 'normal')};
128+
font-size: ${(p) =>
129+
p.type === 'task' ? 'var(--timeline-row-label-task-font-size)' : 'var(--timeline-row-label-step-font-size)'};
130+
font-weight: ${(p) =>
131+
p.type === 'step' ? 'var(--timeline-row-label-step-font-weight)' : 'var(--timeline-row-label-task-font-weight)'};
130132
line-height: 1.6875rem;
131-
border-left: var(--border-thin-1);
133+
border-left: var(--timeline-row-label-border-left);
134+
border-bottom: var(--timeline-row-label-border-bottom);
132135
padding-left: ${(p) => (p.type === 'task' ? '0.5rem' : undefined)};
133136
134137
a {
135138
display: flex;
136139
width: 100%;
137-
color: var(--color-text-primary);
140+
color: ${(p) =>
141+
p.type === 'task' ? 'var(--timeline-row-label-task-text-color)' : '--timeline-row-label-step-text-color'};
138142
text-decoration: none;
139143
max-width: 100%;
140144
white-space: nowrap;
@@ -200,7 +204,8 @@ const StepLabel = styled.div<{ isLoading: boolean }>`
200204
display: flex;
201205
align-items: center;
202206
user-select: text;
203-
font-size: 0.75rem;
207+
font-size: var(--timeline-row-label-step-font-size);
208+
color: var(--timeline-row-label-step-text-color);
204209
205210
i {
206211
width: 1.875rem;

src/components/Timeline/Timeline.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,11 @@ const ListContainer = styled.div<{ customMinHeight: number }>`
281281
min-height: ${(p) => `${p.customMinHeight}rem`};
282282
max-width: 100%;
283283
position: relative;
284+
285+
background: var(--timeline-bg);
286+
border-radius: var(--timeline-border-radius);
287+
padding: var(--timeline-padding);
288+
box-shadow: var(--timeline-shadow);
284289
`;
285290

286291
export default Timeline;

src/components/Timeline/TimelineRow/LineElement.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ export const BoxGraphicValue = styled.div<{ position: LabelPosition }>`
158158
top: 50%;
159159
transform: translateY(-50%);
160160
z-index: -1;
161-
background: var(--color-bg-primary);
162161
}
163162
`;
164163

@@ -185,6 +184,7 @@ const UnkownMoveAnimation = keyframes`
185184
const BoxGraphicLine = styled.div<{ grayed?: boolean; state: string; isLastAttempt: boolean }>`
186185
position: absolute;
187186
background: ${(p) => lineColor(p.grayed || false, p.state, p.isLastAttempt)};
187+
border-radius: var(--timeline-line-border-radius);
188188
width: 100%;
189189
height: 0.375rem;
190190
top: 50%;

src/components/Timeline/TimelineRow/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ const StyledRow = styled.div`
134134
display: flex;
135135
width: 100%;
136136
min-height: 1.75rem;
137-
border-bottom: var(--border-thin-1);
138137
transition: background 0.15s;
139138
140139
&:hover {
@@ -158,7 +157,8 @@ const StickyStyledRow = styled(StyledRow)`
158157
const RowContainerStyles = css`
159158
position: relative;
160159
width: 100%;
161-
border-left: var(--border-thin-1);
160+
border-left: var(--timeline-row-separator-border);
161+
border-bottom: var(--timeline-row-border-bottom);
162162
overflow-x: hidden;
163163
`;
164164

src/components/Timeline/TimelineRow/utils.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,22 @@ export function getRowStatus(
4343

4444
export function lineColor(grayed: boolean, state: string, isFirst: boolean): string {
4545
if (grayed) {
46-
return '#c7c7c7';
46+
return 'var(--timeline-line-color-neutral)';
4747
} else {
4848
switch (state) {
4949
case 'completed':
5050
case 'ok':
51-
return !isFirst ? brightenCssVar('--color-bg-danger', 30) : 'var(--color-bg-success)';
51+
return !isFirst ? brightenCssVar('--timeline-line-color-danger', 30) : 'var(--timeline-line-color-success)';
5252
case 'running':
53-
return 'var(--color-bg-success-light)';
53+
return 'var(--timeline-line-color-running)';
5454
case 'pending':
55-
return 'var(--color-bg-warning';
55+
return 'var(--timeline-line-color-warning)';
5656
case 'failed':
57-
return !isFirst ? brightenCssVar('--color-bg-danger', 30) : 'var(--color-bg-danger)';
57+
return !isFirst ? brightenCssVar('--timeline-line-color-danger', 30) : 'var(--timeline-line-color-danger)';
5858
case 'unknown':
59-
return !isFirst ? brightenCssVar('--color-bg-disabled', 30) : 'var(--color-bg-disabled)';
59+
return !isFirst ? brightenCssVar('--timeline-line-color-unknown', 30) : 'var(--timeline-line-color-unknown)';
6060
default:
61-
return brightenCssVar('--color-bg-disabled', 50);
61+
return brightenCssVar('--timeline-line-color-unknown', 50);
6262
}
6363
}
6464
}

src/pages/Task/components/AnchoredView.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ const AnchoredViewContainer = styled.div`
109109

110110
const TaskContent = styled.div`
111111
flex: 1;
112-
113-
padding: 0 2rem 0 1rem;
112+
background: var(--task-content-bg);
113+
border-radius: var(--task-content-border-radius);
114+
margin: var(--task-content-margin);
115+
padding: var(--task-content-padding);
116+
box-shadow: var(--task-content-shadow);
114117
`;
115118

116119
export default AnchoredView;

src/theme/theme.css

+40
Original file line numberDiff line numberDiff line change
@@ -281,4 +281,44 @@
281281
--data-header-label-font-weight: var(--font-weight-medium);
282282

283283
--data-header-link-color: #fff;
284+
285+
/* Timeline */
286+
287+
--timeline-bg: none;
288+
--timeline-border-radius: none;
289+
--timeline-padding: none;
290+
--timeline-shadow: none;
291+
292+
--timeline-line-border-radius: none;
293+
--timeline-line-color-neutral: #c7c7c7;
294+
--timeline-line-color-success: var(--color-bg-success);
295+
--timeline-line-color-running: var(--color-bg-success-light);
296+
--timeline-line-color-warning: var(--color-bg-warning);
297+
--timeline-line-color-danger: var(--color-bg-danger);
298+
--timeline-line-color-unknown: var(--color-bg-disabled);
299+
300+
--timeline-row-border-bottom: var(--border-thin-1);
301+
--timeline-row-separator-border: var(--border-thin-1);
302+
--timeline-row-label-border-left: var(--border-thin-1);
303+
--timeline-row-label-border-bottom: var(--border-thin-1);
304+
305+
--timeline-row-label-task-font-size: var(--font-size-4);
306+
--timeline-row-label-task-font-weight: var(--font-weight-regular);
307+
--timeline-row-label-task-text-color: var(--color-text-primary);
308+
309+
--timeline-row-label-step-font-size: var(--font-size-4);
310+
--timeline-row-label-step-font-weight: var(--font-weight-semibold);
311+
--timeline-row-label-step-text-color: var(--color-text-primary);
312+
313+
--timeline-footer-border: var(--border-medium-1);
314+
--timeline-footer-bg: var(--color-bg-secondary);
315+
--timeline-footer-selected-bg: var(--color-bg-primary);
316+
317+
/* Task content */
318+
--task-content-bg: none;
319+
--task-content-border-radius: none;
320+
--task-content-padding: 0 2rem 0 1rem;
321+
--task-content-margin: none;
322+
--task-content-shadow: none;
323+
284324
}

0 commit comments

Comments
 (0)