Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 77e3034

Browse files
committed
Rename style to variant
1 parent c16557a commit 77e3034

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

site/src/pages/TaskPage/TaskPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const TaskPage = () => {
125125
<WorkspaceBuildProgress
126126
workspace={task.workspace}
127127
transitionStats={transition}
128-
style="task"
128+
variant="task"
129129
/>
130130
</div>
131131
</div>

site/src/pages/WorkspacePage/WorkspaceBuildProgress.tsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,18 @@ const estimateFinish = (
6262
interface WorkspaceBuildProgressProps {
6363
workspace: Workspace;
6464
transitionStats: TransitionStats;
65-
style?: "workspace" | "task";
65+
// variant changes how the progress bar is displayed: with the workspace
66+
// variant the workspace transition and time remaining are displayed under the
67+
// bar aligned to the left and right respectively. With the task variant the
68+
// workspace transition is not displayed and the time remaining is displayed
69+
// centered above the bar, and the bar's border radius is removed.
70+
variant?: "workspace" | "task";
6671
}
6772

6873
export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
6974
workspace,
7075
transitionStats,
71-
style,
76+
variant,
7277
}) => {
7378
const job = workspace.latest_build.job;
7479
const [progressValue, setProgressValue] = useState<number | undefined>(0);
@@ -116,7 +121,7 @@ export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
116121
}
117122
return (
118123
<div css={styles.stack}>
119-
{style === "task" && (
124+
{variant === "task" && (
120125
<div className="mb-1 text-center">
121126
<div css={styles.label} data-chromatic="ignore">
122127
{progressText}
@@ -135,15 +140,17 @@ export const WorkspaceBuildProgress: FC<WorkspaceBuildProgressProps> = ({
135140
? "determinate"
136141
: "indeterminate"
137142
}
138-
// If a transition is set, there is a moment on new load where the
139-
// bar accelerates to progressValue and then rapidly decelerates, which
140-
// is not indicative of true progress.
141143
classes={{
144+
// If a transition is set, there is a moment on new load where the bar
145+
// accelerates to progressValue and then rapidly decelerates, which is
146+
// not indicative of true progress.
142147
bar: classNames.bar,
143-
root: style === "task" ? classNames.root : undefined,
148+
// With the "task" variant, the progress bar is fullscreen, so remove
149+
// the border radius.
150+
root: variant === "task" ? classNames.root : undefined,
144151
}}
145152
/>
146-
{style !== "task" && (
153+
{variant !== "task" && (
147154
<div className="flex mt-1 justify-between">
148155
<div css={styles.label}>
149156
{capitalize(workspace.latest_build.status)} workspace...

0 commit comments

Comments
 (0)