Skip to content

Commit 1b17f6a

Browse files
committed
tweak copy button styles
1 parent 4a92fb7 commit 1b17f6a

2 files changed

Lines changed: 31 additions & 18 deletions

File tree

apps/web/app/app.dub.co/(dashboard)/[slug]/links/[...link]/page-client.tsx

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { useMetatags } from "@/ui/links/link-builder/use-metatags";
2828
import { LinkControls } from "@/ui/links/link-controls";
2929
import {
3030
Button,
31-
CircleCheck,
31+
Check,
3232
Copy,
3333
useCopyToClipboard,
3434
useKeyboardShortcut,
@@ -161,26 +161,39 @@ function LinkBuilder({ link }: { link: ExpandedLinkProps }) {
161161
props={link}
162162
workspaceId={workspace.id!}
163163
/>
164-
<div className="shrink-0">
165-
<LinkAnalyticsBadge link={link} />
166-
</div>
167164
<Button
168-
variant="secondary"
169-
className="h-7 w-fit px-2"
170-
text={isMobile ? undefined : "Copy"}
171165
icon={
172-
copied ? (
173-
<CircleCheck className="size-4" />
174-
) : (
175-
<Copy className="size-4" />
176-
)
177-
}
178-
onClick={() =>
179-
toast.promise(copyToClipboard(link.shortLink), {
180-
success: "Copied to clipboard!",
181-
})
166+
<div className="relative size-4">
167+
<div
168+
className={cn(
169+
"absolute inset-0 transition-[transform,opacity]",
170+
copied && "translate-y-1 opacity-0",
171+
)}
172+
>
173+
<Copy className="size-4" />
174+
</div>
175+
<div
176+
className={cn(
177+
"absolute inset-0 transition-[transform,opacity]",
178+
!copied && "translate-y-1 opacity-0",
179+
)}
180+
>
181+
<Check className="size-4" />
182+
</div>
183+
</div>
182184
}
185+
text="Copy link"
186+
variant="secondary"
187+
className="xs:w-fit h-7 px-2.5"
188+
onClick={() => {
189+
copyToClipboard(link.shortLink).then(() => {
190+
toast.success("Link copied to clipboard");
191+
});
192+
}}
183193
/>
194+
<div className="shrink-0">
195+
<LinkAnalyticsBadge link={link} />
196+
</div>
184197
<Controls link={link} />
185198
</div>
186199
</LinkBuilderHeader>

apps/web/ui/links/link-builder/draft-controls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export const DraftControls = forwardRef<
148148
type="button"
149149
variant="outline"
150150
className={cn(
151-
"animate-fade-in group h-9 w-fit text-sm transition-colors data-[state=open]:bg-neutral-100",
151+
"animate-fade-in group h-7 w-fit text-sm transition-colors data-[state=open]:bg-neutral-100",
152152
isDirty && hasSaved
153153
? "pl-3 pr-4 text-neutral-400 hover:text-neutral-600"
154154
: "pl-4 pr-3 text-neutral-500 hover:text-neutral-700",

0 commit comments

Comments
 (0)