Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Migrate public link copy panel from Emotion to Mantine and CSS module (#74998)

Andrei Chernykhd971c1216dd6
diff --git a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.module.css b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.module.css
new file mode 100644
index 00000000000..5d58dce8e97
--- /dev/null
+++ b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.module.css
@@ -0,0 +1,13 @@
+.copyButton {
+ position: relative;
+ top: 2px;
+ cursor: pointer;
+
+ &:hover {
+ color: var(--mb-color-brand);
+ }
+}
+
+.removeLink {
+ white-space: nowrap;
+}
diff --git a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.styled.tsx b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.styled.tsx
deleted file mode 100644
index c502e07f900..00000000000
--- a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.styled.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-// eslint-disable-next-line no-restricted-imports
-import styled from "@emotion/styled";
-import type { ComponentProps, ElementType, HTMLAttributes } from "react";
-
-import { CopyButton } from "metabase/common/components/CopyButton";
-import { Anchor } from "metabase/ui";
-
-export const PublicLinkCopyButton = styled(CopyButton)`
- position: relative;
- top: 2px;
- cursor: pointer;
-
- &:hover {
- color: var(--mb-color-brand);
- }
-`;
-
-export const RemoveLinkAnchor = styled(Anchor)<
- ComponentProps<typeof Anchor<ElementType>> & HTMLAttributes<HTMLAnchorElement>
->`
- white-space: nowrap;
-`;
diff --git a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.tsx b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.tsx
index be205ab3603..a8f643c669e 100644
--- a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.tsx
+++ b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkCopyPanel.tsx
@@ -1,6 +1,7 @@
import type { MouseEventHandler } from "react";
import { t } from "ttag";
+import { CopyButton } from "metabase/common/components/CopyButton";
import type { ExportFormat } from "metabase/common/types/export";
import {
Anchor,
@@ -12,10 +13,7 @@ import {
Tooltip,
} from "metabase/ui";
-import {
- PublicLinkCopyButton,
- RemoveLinkAnchor,
-} from "./PublicLinkCopyPanel.styled";
+import S from "./PublicLinkCopyPanel.module.css";
export const PublicLinkCopyPanel = ({
loading = false,
@@ -45,7 +43,11 @@ export const PublicLinkCopyPanel = ({
placeholder={loading ? t`Loading…` : undefined}
value={url ?? ""}
inputWrapperOrder={["label", "input", "error", "description"]}
- rightSection={url && <PublicLinkCopyButton value={url} onCopy={onCopy} />}
+ rightSection={
+ url && (
+ <CopyButton className={S.copyButton} value={url} onCopy={onCopy} />
+ )
+ }
/>
<Box pos="relative">
<Group
@@ -65,15 +67,16 @@ export const PublicLinkCopyPanel = ({
</Text>
}
>
- <RemoveLinkAnchor
+ <Anchor
component="button"
+ className={S.removeLink}
fz="sm"
c="error"
fw={700}
onClick={onRemoveLink}
>
{removeButtonLabel}
- </RemoveLinkAnchor>
+ </Anchor>
</Tooltip>
)}
</Box>