Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
+77
@@ -0,0 +1,77 @@
|
||||
"use client";
|
||||
/*
|
||||
* Documentation:
|
||||
* Copy to clipboard button — https://app.subframe.com/f023064a5ca0/library?component=Copy+to+clipboard+button_e8c76626-6462-4f2f-b595-38d530d427e8
|
||||
* Tooltip — https://app.subframe.com/f023064a5ca0/library?component=Tooltip_ccebd1e9-f6ac-4737-8376-0dfacd90c9f3
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { FeatherCopy } from "@subframe/core";
|
||||
import * as SubframeCore from "@subframe/core";
|
||||
import * as SubframeUtils from "../../utils";
|
||||
import { Tooltip } from "../Tooltip";
|
||||
|
||||
export interface CopyToClipboardButtonRootProps
|
||||
extends Omit<
|
||||
React.ComponentProps<typeof SubframeCore.CopyToClipboard.Root>,
|
||||
"clipboardText"
|
||||
> {
|
||||
clipboardText?: React.ReactNode;
|
||||
tooltipText?: React.ReactNode;
|
||||
icon?: React.ReactNode;
|
||||
onCopy?: () => void;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const CopyToClipboardButtonRoot = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
CopyToClipboardButtonRootProps
|
||||
>(function CopyToClipboardButtonRoot(
|
||||
{
|
||||
clipboardText,
|
||||
tooltipText,
|
||||
icon = <FeatherCopy />,
|
||||
className,
|
||||
...otherProps
|
||||
}: CopyToClipboardButtonRootProps,
|
||||
ref
|
||||
) {
|
||||
return (
|
||||
<SubframeCore.Tooltip.Provider>
|
||||
<SubframeCore.Tooltip.Root>
|
||||
<SubframeCore.Tooltip.Trigger asChild={true}>
|
||||
<SubframeCore.CopyToClipboard.Root
|
||||
clipboardText={clipboardText as string}
|
||||
{...otherProps}
|
||||
>
|
||||
<div
|
||||
className={SubframeUtils.twClassNames(
|
||||
"group/e8c76626 flex h-6 w-6 cursor-pointer flex-col items-center justify-center gap-2 rounded-md hover:bg-[#f5f5f5]",
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
>
|
||||
{icon ? (
|
||||
<SubframeCore.IconWrapper className="font-['Inter'] text-[14px] font-[400] leading-[20px] text-[#737373] group-hover/e8c76626:text-[#171717]">
|
||||
{icon}
|
||||
</SubframeCore.IconWrapper>
|
||||
) : null}
|
||||
</div>
|
||||
</SubframeCore.CopyToClipboard.Root>
|
||||
</SubframeCore.Tooltip.Trigger>
|
||||
<SubframeCore.Tooltip.Portal>
|
||||
<SubframeCore.Tooltip.Content
|
||||
side="bottom"
|
||||
align="center"
|
||||
sideOffset={8}
|
||||
asChild={true}
|
||||
>
|
||||
<Tooltip>{tooltipText}</Tooltip>
|
||||
</SubframeCore.Tooltip.Content>
|
||||
</SubframeCore.Tooltip.Portal>
|
||||
</SubframeCore.Tooltip.Root>
|
||||
</SubframeCore.Tooltip.Provider>
|
||||
);
|
||||
});
|
||||
|
||||
export const CopyToClipboardButton = CopyToClipboardButtonRoot;
|
||||
Reference in new issue
Block a user