Skip to content

armgit / ente

Public Imported from GitHub
0

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

2nd dup

Manav Rathi310e31905765
diff --git a/web/packages/new/photos/components/Gallery/BarImpl.tsx b/web/packages/new/photos/components/Gallery/BarImpl.tsx
index 0401e02c99..18a168c267 100644
--- a/web/packages/new/photos/components/Gallery/BarImpl.tsx
+++ b/web/packages/new/photos/components/Gallery/BarImpl.tsx
@@ -1,7 +1,10 @@
import { useIsMobileWidth } from "@/base/hooks";
import { CollectionsSortOptions } from "@/new/photos/components/CollectionsSortOptions";
import { BarItemTile, ItemCard } from "@/new/photos/components/ItemCards";
-import { FilledIconButton } from "@/new/photos/components/mui-custom";
+import {
+ FilledIconButton,
+ UnstyledButton,
+} from "@/new/photos/components/mui-custom";
import {
IMAGE_CONTAINER_MAX_WIDTH,
MIN_COLUMNS,
@@ -327,22 +330,10 @@ const ModeIndicator: React.FC<
);
};
-const AlbumModeButton = styled("button")(
+const AlbumModeButton = styled(UnstyledButton)(
({ theme }) => `
- /* Reset some button defaults that are unwanted here. */
- background: transparent;
- border: 0;
- padding: 0;
- /* Not sure why the button's default pointer is not coming into effect
- automatically. */
- cursor: pointer;
- font: inherit;
- p {
- color: ${theme.colors.text.muted}
- }
- p:hover {
- color: ${theme.colors.text.base};
- }
+ p { color: ${theme.colors.text.muted} }
+ p:hover { color: ${theme.colors.text.base} }
`,
);
diff --git a/web/packages/new/photos/components/SearchBar.tsx b/web/packages/new/photos/components/SearchBar.tsx
index 3c447a855e..752b8aeec7 100644
--- a/web/packages/new/photos/components/SearchBar.tsx
+++ b/web/packages/new/photos/components/SearchBar.tsx
@@ -42,6 +42,7 @@ import {
} from "react-select";
import AsyncSelect from "react-select/async";
import { SearchPeopleList } from "./PeopleList";
+import { UnstyledButton } from "./mui-custom";
export interface SearchBarProps {
/**
@@ -438,15 +439,8 @@ const PeopleHeader: React.FC<PeopleHeaderProps> = ({ onClick }) => (
</PeopleHeaderButton>
);
-const PeopleHeaderButton = styled("button")(
+const PeopleHeaderButton = styled(UnstyledButton)(
({ theme }) => `
- /* Reset some button defaults that are affecting us */
- background: transparent;
- border: 0;
- padding: 0;
- font: inherit;
- /* Button should do this for us, but it isn't working inside the select */
- cursor: pointer;
/* The color for the chevron */
color: ${theme.colors.stroke.muted};
/* Hover indication */
diff --git a/web/packages/new/photos/components/mui-custom.tsx b/web/packages/new/photos/components/mui-custom.tsx
index e5bb46dc2a..e41a42d3d9 100644
--- a/web/packages/new/photos/components/mui-custom.tsx
+++ b/web/packages/new/photos/components/mui-custom.tsx
@@ -6,3 +6,26 @@ import { IconButton, styled } from "@mui/material";
export const FilledIconButton = styled(IconButton)(({ theme }) => ({
backgroundColor: theme.colors.fill.faint,
}));
+
+/**
+ * An "unstyled" button.
+ *
+ * There are cases where we semantically (and functionally) want a button, but
+ * don't want the browser's default styling. This component is meant to act as a
+ * base for such cases.
+ */
+export const UnstyledButton = styled("button")`
+ /* Reset some button defaults that are affecting us */
+ background: transparent;
+ border: 0;
+ padding: 0;
+
+ font: inherit;
+ /* We customized the letter spacing in the theme. Need to tell the button to
+ inherit that customization also. */
+ letter-spacing: inherit;
+
+ /* Button should do this for us (I think), but it isn't working for some
+ reason I don't yet know (maybe something we customized in the theme?) */
+ cursor: pointer;
+`;