Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

ex

Manav Rathi7a2f08f49aab
diff --git a/web/packages/new/photos/components/DevSettings.tsx b/web/packages/new/photos/components/DevSettings.tsx
index 8c7d9356fe..bf65559851 100644
--- a/web/packages/new/photos/components/DevSettings.tsx
+++ b/web/packages/new/photos/components/DevSettings.tsx
@@ -1,17 +1,16 @@
import {
- Button,
Dialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
TextField,
- styled,
useMediaQuery,
type ModalProps,
} from "@mui/material";
import { useFormik } from "formik";
import React from "react";
+import { FocusVisibleButton } from "./FocusVisibleButton";
import { SlideTransition } from "./SlideTransition";
interface DevSettingsProps {
@@ -77,7 +76,7 @@ export const DevSettings: React.FC<DevSettingsProps> = ({ open, onClose }) => {
</DialogContentText>
</DialogContent>
<DialogActions>
- <StyledButton
+ <FocusVisibleButton
type="submit"
color="accent"
fullWidth
@@ -85,25 +84,17 @@ export const DevSettings: React.FC<DevSettingsProps> = ({ open, onClose }) => {
disableRipple
>
{"Save"}
- </StyledButton>
- <StyledButton
+ </FocusVisibleButton>
+ <FocusVisibleButton
onClick={onClose}
color="secondary"
fullWidth
disableRipple
>
{"Cancel"}
- </StyledButton>
+ </FocusVisibleButton>
</DialogActions>
</form>
</Dialog>
);
};
-
-const StyledButton = styled(Button)`
- /* Show an outline when the button gains keyboard focus, e.g. when the user
- tabs to it. */
- &.Mui-focusVisible {
- outline: 1px solid #aaa;
- }
-`;
diff --git a/web/packages/new/photos/components/FocusVisibleButton.tsx b/web/packages/new/photos/components/FocusVisibleButton.tsx
new file mode 100644
index 0000000000..306b62e173
--- /dev/null
+++ b/web/packages/new/photos/components/FocusVisibleButton.tsx
@@ -0,0 +1,10 @@
+import { Button, styled } from "@mui/material";
+
+/** A MUI {@link Button} that shows a keyboard focus indicator. */
+export const FocusVisibleButton = styled(Button)`
+ /* Show an outline when the button gains keyboard focus, e.g. when the user
+ tabs to it. */
+ &.Mui-focusVisible {
+ outline: 1px solid #aaa;
+ }
+`;
diff --git a/web/packages/new/photos/components/WhatsNew.tsx b/web/packages/new/photos/components/WhatsNew.tsx
index 76a81e7b70..681360a454 100644
--- a/web/packages/new/photos/components/WhatsNew.tsx
+++ b/web/packages/new/photos/components/WhatsNew.tsx
@@ -1,6 +1,5 @@
import ArrowForward from "@mui/icons-material/ArrowForward";
import {
- Button,
Dialog,
DialogActions,
DialogContent,
@@ -12,6 +11,7 @@ import {
} from "@mui/material";
import React, { useEffect } from "react";
import { didShowWhatsNew } from "../services/changelog";
+import { FocusVisibleButton } from "./FocusVisibleButton";
import { SlideTransition } from "./SlideTransition";
interface WhatsNewProps {
@@ -45,7 +45,7 @@ export const WhatsNew: React.FC<WhatsNewProps> = ({ open, onClose }) => {
</DialogContentText>
</DialogContent>
<DialogActions>
- <StyledButton
+ <FocusVisibleButton
onClick={onClose}
color="accent"
fullWidth
@@ -53,7 +53,7 @@ export const WhatsNew: React.FC<WhatsNewProps> = ({ open, onClose }) => {
endIcon={<ArrowForward />}
>
<ButtonContents>{"Continue"}</ButtonContents>
- </StyledButton>
+ </FocusVisibleButton>
</DialogActions>
</Dialog>
);
@@ -92,14 +92,6 @@ const StyledUL = styled("ul")`
}
`;
-const StyledButton = styled(Button)`
- /* Show an outline when the button gains keyboard focus, e.g. when the user
- tabs to it. */
- &.Mui-focusVisible {
- outline: 1px solid #aaa;
- }
-`;
-
const ButtonContents = styled("div")`
/* Make the button text fill the entire space so the endIcon shows at the
trailing edge of the button. */