fix: Workspace schedule button on responsive (#3264)

This commit is contained in:
Bruno Quaresma
2022-07-28 16:17:50 +00:00
committed by GitHub
parent 2805d86ba9
commit 1a8cce27ae
3 changed files with 37 additions and 8 deletions
@@ -87,3 +87,11 @@ CannotEdit.args = {
},
canUpdateWorkspace: false,
}
export const SmallViewport = Template.bind({})
SmallViewport.args = {
...WorkspaceOffShort.args,
}
SmallViewport.parameters = {
chromatic: { viewports: [320] },
}
@@ -140,6 +140,10 @@ const useStyles = makeStyles((theme) => ({
alignItems: "center",
border: `1px solid ${theme.palette.divider}`,
borderRadius: `${theme.shape.borderRadius}px`,
[theme.breakpoints.down("sm")]: {
flexDirection: "column",
},
},
label: {
borderRight: 0,
@@ -150,11 +154,15 @@ const useStyles = makeStyles((theme) => ({
width: "100%",
display: "flex",
alignItems: "center",
padding: theme.spacing(1.5, 2),
},
},
actions: {
[theme.breakpoints.down("sm")]: {
marginLeft: "auto",
display: "flex",
paddingLeft: theme.spacing(1),
marginRight: -theme.spacing(1),
},
},
scheduleButton: {
@@ -162,6 +170,13 @@ const useStyles = makeStyles((theme) => ({
borderLeft: `1px solid ${theme.palette.divider}`,
borderRadius: `0px ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px 0px`,
flexShrink: 0,
[theme.breakpoints.down("sm")]: {
width: "100%",
borderLeft: 0,
borderTop: `1px solid ${theme.palette.divider}`,
borderRadius: `0 0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px`,
},
},
iconButton: {
borderRadius: 2,
@@ -14,18 +14,16 @@ export const WorkspaceScheduleLabel: React.FC<{ workspace: Workspace }> = ({ wor
// If it is shutting down, we don't need to display the auto stop label
return (
<span className={combineClasses([styles.labelText, "chromatic-ignore"])}>
{shouldDisplayStrongLabel && (
<strong className={styles.labelStrong}>{Language.autoStopLabel}</strong>
)}
{stopLabel}
{shouldDisplayStrongLabel && <strong>{Language.autoStopLabel}</strong>}{" "}
<span className={styles.value}>{stopLabel}</span>
</span>
)
}
return (
<span className={combineClasses([styles.labelText, "chromatic-ignore"])}>
<strong className={styles.labelStrong}>{Language.autoStartLabel}</strong>
{autoStartDisplay(workspace.autostart_schedule)}
<strong>{Language.autoStartLabel}</strong>{" "}
<span className={styles.value}>{autoStartDisplay(workspace.autostart_schedule)}</span>
</span>
)
}
@@ -33,9 +31,17 @@ export const WorkspaceScheduleLabel: React.FC<{ workspace: Workspace }> = ({ wor
const useStyles = makeStyles((theme) => ({
labelText: {
marginRight: theme.spacing(2),
lineHeight: "160%",
[theme.breakpoints.down("sm")]: {
marginRight: 0,
width: "100%",
},
},
labelStrong: {
marginRight: theme.spacing(0.5),
value: {
[theme.breakpoints.down("sm")]: {
whiteSpace: "nowrap",
},
},
}))