Skip to content

fix: Workspace schedule button on responsive #3264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,11 @@ CannotEdit.args = {
},
canUpdateWorkspace: false,
}

export const SmallViewport = Template.bind({})
SmallViewport.args = {
...WorkspaceOffShort.args,
}
SmallViewport.parameters = {
chromatic: { viewports: [320] },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks useful, how does it work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We basically are saying to chromatic to test this snapshot using the 320px viewport. Unfortunately, looks like a Chromatic thing not a Storybook native option.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like maybe Chromatic isn't registering this one?

}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -150,18 +154,29 @@ 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: {
border: "none",
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,34 @@ 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>
)
}

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",
},
},
}))