10000 fix: redesign schedule bumper to handle multiple hours of change at once by presleyp · Pull Request #4535 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

fix: redesign schedule bumper to handle multiple hours of change at once #4535

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 15 commits into from
Oct 14, 2022
Prev Previous commit
Next Next commit
Highlight chosen mode
  • Loading branch information
presleyp committed Oct 11, 2022
commit 833210e58d5fbc7fd80eaffc2c8d2d601b1aa769
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Button from "@material-ui/core/Button"
import IconButton from "@material-ui/core/IconButton"
import Popover from "@material-ui/core/Popover"
import { makeStyles } from "@material-ui/core/styles"
import { makeStyles, Theme } from "@material-ui/core/styles"
import Tooltip from "@material-ui/core/Tooltip"
import AddIcon from "@material-ui/icons/Add"
import RemoveIcon from "@material-ui/icons/Remove"
Expand Down Expand Up @@ -69,7 +69,7 @@ export const WorkspaceScheduleButton: React.FC<
const [isOpen, setIsOpen] = useState(false)
const [editMode, setEditMode] = useState<EditMode>("off")
const id = isOpen ? "schedule-popover" : undefined
const styles = useStyles(editMode)
const styles = useStyles({ editMode })

const onClose = () => {
setIsOpen(false)
Expand All @@ -93,7 +93,7 @@ export const WorkspaceScheduleButton: React.FC<
<Maybe condition={canUpdateWorkspace && canEditDeadline(workspace)}>
<span className={styles.actions}>
<IconButton
className={styles.iconButton}
className={styles.subtractButton}
size="small"
disabled={!deadlineMinusEnabled()}
onClick={() => {
Expand All @@ -105,7 +105,7 @@ export const WorkspaceScheduleButton: React.FC<
</Tooltip>
</IconButton>
<IconButton
className={styles.iconButton}
className={styles.addButton}
size="small"
disabled={!deadlinePlusEnabled()}
onClick={() => {
Expand Down Expand Up @@ -161,7 +161,11 @@ export const WorkspaceScheduleButton: React.FC<
)
}

const useStyles = makeStyles((theme) => ({
interface StyleProps {
editMode: EditMode
}

const useStyles = makeStyles<Theme, StyleProps>((theme) => ({
wrapper: {
display: "inline-flex",
alignItems: "center",
Expand Down Expand Up @@ -212,8 +216,13 @@ const useStyles = makeStyles((theme) => ({
},
},
},
iconButton: {
addButton: {
borderRadius: theme.shape.borderRadius,
backgroundColor: ({ editMode }) => editMode === "add" ? theme.palette.primary.main : "inherit"
},
subtractButton: {
borderRadius: theme.shape.borderRadius,
backgroundColor: ({ editMode }) => editMode === "subtract" ? theme.palette.primary.main : "inherit"
},
popoverPaper: {
padding: `${theme.spacing(2)}px ${theme.spacing(3)}px ${theme.spacing(
Expand Down
0