Skip to content

Commit 9a5fa3f

Browse files
authored
fix: border fixes for workspace schedule button (coder#3010)
* border fixes for workspace schedule button * fixing chromatic snapshots * chromatic fix
1 parent d04ba2c commit 9a5fa3f

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

site/src/components/WorkspaceScheduleButton/WorkspaceScheduleButton.tsx

+19-18
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import utc from "dayjs/plugin/utc"
1515
import { useRef, useState } from "react"
1616
import { Workspace } from "../../api/typesGenerated"
1717
import { isWorkspaceOn } from "../../util/workspace"
18-
import { Stack } from "../Stack/Stack"
1918
import { WorkspaceSchedule } from "../WorkspaceSchedule/WorkspaceSchedule"
2019
import { WorkspaceScheduleLabel } from "./WorkspaceScheduleLabel"
2120

@@ -28,6 +27,7 @@ dayjs.extend(relativeTime)
2827
dayjs.extend(timezone)
2928

3029
export const Language = {
30+
schedule: "Schedule",
3131
editDeadlineMinus: "Subtract one hour",
3232
editDeadlinePlus: "Add one hour",
3333
}
@@ -73,11 +73,11 @@ export const WorkspaceScheduleButton: React.FC<WorkspaceScheduleButtonProps> = (
7373
}
7474

7575
return (
76-
<div className={styles.wrapper}>
77-
<div className={styles.label}>
76+
<span className={styles.wrapper}>
77+
<span className={styles.label}>
7878
<WorkspaceScheduleLabel workspace={workspace} />
7979
{canUpdateWorkspace && shouldDisplayPlusMinus(workspace) && (
80-
<Stack direction="row" spacing={0}>
80+
<span>
8181
<IconButton
8282
className={styles.iconButton}
8383
size="small"
@@ -98,18 +98,19 @@ export const WorkspaceScheduleButton: React.FC<WorkspaceScheduleButtonProps> = (
9898
<AddIcon />
9999
</Tooltip>
100100
</IconButton>
101-
</Stack>
101+
</span>
102102
)}
103-
</div>
104-
<div>
103+
</span>
104+
<>
105105
<Button
106106
ref={anchorRef}
107107
startIcon={<ScheduleIcon />}
108108
onClick={() => {
109109
setIsOpen(true)
110110
}}
111+
className={styles.scheduleButton}
111112
>
112-
Schedule
113+
{Language.schedule}
113114
</Button>
114115
<Popover
115116
classes={{ paper: styles.popoverPaper }}
@@ -128,33 +129,33 @@ export const WorkspaceScheduleButton: React.FC<WorkspaceScheduleButtonProps> = (
128129
>
129130
<WorkspaceSchedule workspace={workspace} canUpdateWorkspace={canUpdateWorkspace} />
130131
</Popover>
131-
</div>
132-
</div>
132+
</>
133+
</span>
133134
)
134135
}
135136

136137
const useStyles = makeStyles((theme) => ({
137138
wrapper: {
138-
display: "flex",
139-
alignItems: "center",
139+
display: "inline-block",
140+
border: `1px solid ${theme.palette.divider}`,
141+
borderRadius: `${theme.shape.borderRadius}px`,
140142
},
141-
142143
label: {
143-
border: `1px solid ${theme.palette.divider}`,
144144
borderRight: 0,
145145
height: "100%",
146-
display: "flex",
147-
alignItems: "center",
148146
padding: "0 8px 0 16px",
149147
color: theme.palette.text.secondary,
150148
// It is from the button props
151149
minHeight: 42,
152150
},
153-
151+
scheduleButton: {
152+
border: "none",
153+
borderLeft: `1px solid ${theme.palette.divider}`,
154+
borderRadius: `0px ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px 0px`,
155+
},
154156
iconButton: {
155157
borderRadius: 2,
156158
},
157-
158159
popoverPaper: {
159160
padding: `${theme.spacing(2)}px ${theme.spacing(3)}px ${theme.spacing(3)}px`,
160161
},

0 commit comments

Comments
 (0)