Skip to content

Commit 5793eec

Browse files
committed
Fixup styling of the badge
1 parent 855e8b8 commit 5793eec

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed

site/src/pages/UserSettingsPage/ExternalAuthPage/ExternalAuthPageView.tsx

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { useTheme } from "@emotion/react";
2-
import CachedIcon from "@mui/icons-material/Cached";
2+
import AutorenewIcon from "@mui/icons-material/Autorenew";
33
import LoadingButton from "@mui/lab/LoadingButton";
44
import Badge from "@mui/material/Badge";
55
import Divider from "@mui/material/Divider";
6+
import { styled } from "@mui/material/styles";
67
import Table from "@mui/material/Table";
78
import TableBody from "@mui/material/TableBody";
89
import TableCell from "@mui/material/TableCell";
@@ -32,6 +33,7 @@ import {
3233
} from "components/MoreMenu/MoreMenu";
3334
import { TableEmpty } from "components/TableEmpty/TableEmpty";
3435
import type { ExternalAuthPollingState } from "pages/CreateWorkspacePage/CreateWorkspacePage";
36+
import { minWidth, padding, width } from "@mui/system";
3537

3638
export type ExternalAuthPageViewProps = {
3739
isLoading: boolean;
@@ -108,6 +110,29 @@ interface ExternalAuthRowProps {
108110
onValidateExternalAuth: () => void;
109111
}
110112

113+
const StyledBadge = styled(Badge)(({ theme }) => ({
114+
"& .MuiBadge-badge": {
115+
// Make a circular background for the icon. Background provides contrast, with a thin
116+
// border to separate it from the avatar image.
117+
backgroundColor: `${theme.palette.background.paper}`,
118+
borderStyle: "solid",
119+
borderColor: `${theme.palette.secondary.main}`,
120+
borderWidth: "thin",
121+
122+
// The size of the badge content should be small, and should perfectly encapsulate the icon.
123+
// By default, the style has padding and a fixed size, which is too large.
124+
// Remove all default padding, and base the size off of the icon size. All based around text
125+
// sizing.
126+
// Ideally, we could use padding to accomplis this, but you have to override the default 'height' and
127+
// 'width' properties.
128+
padding: "0px",
129+
minHeight: "0px",
130+
minWidth: "0px",
131+
height: "1.4em",
132+
width: "1.4em",
133+
},
134+
}));
135+
111136
const ExternalAuthRow: FC<ExternalAuthRowProps> = ({
112137
app,
113138
unlinked,
@@ -140,22 +165,28 @@ const ExternalAuthRow: FC<ExternalAuthRowProps> = ({
140165
// attempt to authenticate when the token expires.
141166
if (link?.has_refresh_token && authenticated) {
142167
avatar = (
143-
<Badge
168+
<StyledBadge
144169
anchorOrigin={{
145170
vertical: "bottom",
146171
horizontal: "right",
147172
}}
173+
color="default"
174+
overlap="circular"
148175
badgeContent={
149176
<Tooltip
150177
title="Authentication token will automatically refresh when expired."
151178
placement="right"
152179
>
153-
<CachedIcon fontSize="small" />
180+
<AutorenewIcon
181+
sx={{
182+
fontSize: "1em",
183+
}}
184+
/>
154185
</Tooltip>
155186
}
156187
>
157188
{avatar}
158-
</Badge>
189+
</StyledBadge>
159190
);
160191
}
161192

0 commit comments

Comments
 (0)