Skip to content

Commit 1a8cce2

Browse files
fix: Workspace schedule button on responsive (#3264)
1 parent 2805d86 commit 1a8cce2

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

site/src/components/WorkspaceScheduleButton/WorkspaceScheduleButton.stories.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,11 @@ CannotEdit.args = {
8787
},
8888
canUpdateWorkspace: false,
8989
}
90+
91+
export const SmallViewport = Template.bind({})
92+
SmallViewport.args = {
93+
...WorkspaceOffShort.args,
94+
}
95+
SmallViewport.parameters = {
96+
chromatic: { viewports: [320] },
97+
}

site/src/components/WorkspaceScheduleButton/WorkspaceScheduleButton.tsx

+15
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ const useStyles = makeStyles((theme) => ({
140140
alignItems: "center",
141141
border: `1px solid ${theme.palette.divider}`,
142142
borderRadius: `${theme.shape.borderRadius}px`,
143+
144+
[theme.breakpoints.down("sm")]: {
145+
flexDirection: "column",
146+
},
143147
},
144148
label: {
145149
borderRight: 0,
@@ -150,18 +154,29 @@ const useStyles = makeStyles((theme) => ({
150154
width: "100%",
151155
display: "flex",
152156
alignItems: "center",
157+
padding: theme.spacing(1.5, 2),
153158
},
154159
},
155160
actions: {
156161
[theme.breakpoints.down("sm")]: {
157162
marginLeft: "auto",
163+
display: "flex",
164+
paddingLeft: theme.spacing(1),
165+
marginRight: -theme.spacing(1),
158166
},
159167
},
160168
scheduleButton: {
161169
border: "none",
162170
borderLeft: `1px solid ${theme.palette.divider}`,
163171
borderRadius: `0px ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px 0px`,
164172
flexShrink: 0,
173+
174+
[theme.breakpoints.down("sm")]: {
175+
width: "100%",
176+
borderLeft: 0,
177+
borderTop: `1px solid ${theme.palette.divider}`,
178+
borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,
179+
},
165180
},
166181
iconButton: {
167182
borderRadius: 2,

site/src/components/WorkspaceScheduleButton/WorkspaceScheduleLabel.tsx

+14-8
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,34 @@ export const WorkspaceScheduleLabel: React.FC<{ workspace: Workspace }> = ({ wor
1414
// If it is shutting down, we don't need to display the auto stop label
1515
return (
1616
<span className={combineClasses([styles.labelText, "chromatic-ignore"])}>
17-
{shouldDisplayStrongLabel && (
18-
<strong className={styles.labelStrong}>{Language.autoStopLabel}</strong>
19-
)}
20-
{stopLabel}
17+
{shouldDisplayStrongLabel && <strong>{Language.autoStopLabel}</strong>}{" "}
18+
<span className={styles.value}>{stopLabel}</span>
2119
</span>
2220
)
2321
}
2422

2523
return (
2624
<span className={combineClasses([styles.labelText, "chromatic-ignore"])}>
27-
<strong className={styles.labelStrong}>{Language.autoStartLabel}</strong>
28-
{autoStartDisplay(workspace.autostart_schedule)}
25+
<strong>{Language.autoStartLabel}</strong>{" "}
26+
<span className={styles.value}>{autoStartDisplay(workspace.autostart_schedule)}</span>
2927
</span>
3028
)
3129
}
3230

3331
const useStyles = makeStyles((theme) => ({
3432
labelText: {
3533
marginRight: theme.spacing(2),
34+
lineHeight: "160%",
35+
36+
[theme.breakpoints.down("sm")]: {
37+
marginRight: 0,
38+
width: "100%",
39+
},
3640
},
3741

38-
labelStrong: {
39-
marginRight: theme.spacing(0.5),
42+
value: {
43+
[theme.breakpoints.down("sm")]: {
44+
whiteSpace: "nowrap",
45+
},
4046
},
4147
}))

0 commit comments

Comments
 (0)