π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web] Use default notification action icon styles
AswinAsokfd7426ab77f9
diff --git a/web/apps/photos/src/components/QuickLinkCreatedNotification.tsx b/web/apps/photos/src/components/QuickLinkCreatedNotification.tsxindex 270934478d..2e48d09efe 100644--- a/web/apps/photos/src/components/QuickLinkCreatedNotification.tsx+++ b/web/apps/photos/src/components/QuickLinkCreatedNotification.tsx@@ -58,8 +58,6 @@ export const QuickLinkCreatedNotification: React.FC<startIcon: null,title: t("link_created"),endIcon: copied ? Tick02Icon : Copy01Icon,- endIconSize: copied ? 22 : 18,- endIconColor: copied ? "success.main" : undefined,endIconLabel: t("copy_link"),onEndIconClick: handleCopy,showCloseButtonWithEndIcon: true,diff --git a/web/apps/photos/tests/notification-icons.test.tsx b/web/apps/photos/tests/notification-icons.test.tsxindex 146c694336..92d5fc599e 100644--- a/web/apps/photos/tests/notification-icons.test.tsx+++ b/web/apps/photos/tests/notification-icons.test.tsx@@ -41,27 +41,21 @@ describe("notification icons", () => {expect(markup).toContain('aria-label="Retry"');});- test("supports a smaller copy icon without changing the close icon", () => {- const markup = renderNotification({- startIcon: null,- endIcon: Copy01Icon,- endIconSize: 18,- showCloseButtonWithEndIcon: true,- });- const icons = markup.match(/<svg\b[^>]*>/g) ?? [];- expect(icons).toHaveLength(2);- expect(icons[0]).toContain('width="18"');- expect(icons[1]).toContain('width="22"');- });-- test("resolves the copied icon color through the theme", () => {- const markup = renderNotification({- startIcon: null,- endIcon: Tick02Icon,- endIconColor: "success.main",- });- expect(markup).toContain("color:var(--mui-palette-success-main)");- expect(markup.match(/<svg\b[^>]*>/g)?.[0]).toContain('width="22"');+ test("uses the same default size and color for copy and copied icons", () => {+ for (const endIcon of [Copy01Icon, Tick02Icon]) {+ const markup = renderNotification({+ color: "inherit",+ startIcon: null,+ endIcon,+ showCloseButtonWithEndIcon: true,+ });+ const icons = markup.match(/<svg\b[^>]*>/g) ?? [];+ expect(icons).toHaveLength(2);+ for (const icon of icons) expect(icon).toContain('width="22"');+ expect(markup).not.toContain(+ "color:var(--mui-palette-success-main)",+ );+ }});test("preserves custom icon elements and their sizing", () => {diff --git a/web/packages/base/components/Notification.tsx b/web/packages/base/components/Notification.tsxindex 8877bca9ff..1bf3e2f3c0 100644--- a/web/packages/base/components/Notification.tsx+++ b/web/packages/base/components/Notification.tsx@@ -34,8 +34,6 @@ export interface NotificationAttributes {caption?: React.ReactNode;onClick?: () => void;endIcon?: NotificationIcon;- endIconSize?: number;- endIconColor?: string;endIconLabel?: string;showCloseButtonWithEndIcon?: boolean;onEndIconClick?: () => void;@@ -50,21 +48,11 @@ type NotificationProps = ModalVisibilityProps & {sx?: SxProps<Theme>;};-const renderIcon = (- icon: NotificationIcon | undefined,- size: number,- color?: string,-) =>+const renderIcon = (icon: NotificationIcon | undefined, size: number) =>React.isValidElement(icon) || icon == null ? (icon) : (- <Box- component={HugeiconsIcon}- icon={icon}- size={size}- strokeWidth={1.8}- sx={{ color }}- />+ <HugeiconsIcon icon={icon} size={size} strokeWidth={1.8} />);const actionButtonSx = {@@ -101,8 +89,6 @@ export const Notification: React.FC<NotificationProps> = ({title,caption,endIcon,- endIconSize = 22,- endIconColor,endIconLabel,showCloseButtonWithEndIcon,onClick,@@ -267,7 +253,7 @@ export const Notification: React.FC<NotificationProps> = ({}}sx={buttonSx}>- {renderIcon(endIcon, endIconSize, endIconColor)}+ {renderIcon(endIcon, 22)}</IconButton>)}{(!endIcon || showCloseButtonWithEndIcon) && (