|
1 | 1 | import { useTheme } from "@emotion/react";
|
2 |
| -import CachedIcon from "@mui/icons-material/Cached"; |
| 2 | +import AutorenewIcon from "@mui/icons-material/Autorenew"; |
3 | 3 | import LoadingButton from "@mui/lab/LoadingButton";
|
4 | 4 | import Badge from "@mui/material/Badge";
|
5 | 5 | import Divider from "@mui/material/Divider";
|
| 6 | +import { styled } from "@mui/material/styles"; |
6 | 7 | import Table from "@mui/material/Table";
|
7 | 8 | import TableBody from "@mui/material/TableBody";
|
8 | 9 | import TableCell from "@mui/material/TableCell";
|
@@ -32,6 +33,7 @@ import {
|
32 | 33 | } from "components/MoreMenu/MoreMenu";
|
33 | 34 | import { TableEmpty } from "components/TableEmpty/TableEmpty";
|
34 | 35 | import type { ExternalAuthPollingState } from "pages/CreateWorkspacePage/CreateWorkspacePage";
|
| 36 | +import { minWidth, padding, width } from "@mui/system"; |
35 | 37 |
|
36 | 38 | export type ExternalAuthPageViewProps = {
|
37 | 39 | isLoading: boolean;
|
@@ -108,6 +110,29 @@ interface ExternalAuthRowProps {
|
108 | 110 | onValidateExternalAuth: () => void;
|
109 | 111 | }
|
110 | 112 |
|
| 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 | + |
111 | 136 | const ExternalAuthRow: FC<ExternalAuthRowProps> = ({
|
112 | 137 | app,
|
113 | 138 | unlinked,
|
@@ -140,22 +165,28 @@ const ExternalAuthRow: FC<ExternalAuthRowProps> = ({
|
140 | 165 | // attempt to authenticate when the token expires.
|
141 | 166 | if (link?.has_refresh_token && authenticated) {
|
142 | 167 | avatar = (
|
143 |
| - <Badge |
| 168 | + <StyledBadge |
144 | 169 | anchorOrigin={{
|
145 | 170 | vertical: "bottom",
|
146 | 171 | horizontal: "right",
|
147 | 172 | }}
|
| 173 | + color="default" |
| 174 | + overlap="circular" |
148 | 175 | badgeContent={
|
149 | 176 | <Tooltip
|
150 | 177 | title="Authentication token will automatically refresh when expired."
|
151 | 178 | placement="right"
|
152 | 179 | >
|
153 |
| - <CachedIcon fontSize="small" /> |
| 180 | + <AutorenewIcon |
| 181 | + sx={{ |
| 182 | + fontSize: "1em", |
| 183 | + }} |
| 184 | + /> |
154 | 185 | </Tooltip>
|
155 | 186 | }
|
156 | 187 | >
|
157 | 188 | {avatar}
|
158 |
| - </Badge> |
| 189 | + </StyledBadge> |
159 | 190 | );
|
160 | 191 | }
|
161 | 192 |
|
|
0 commit comments