Skip to content

Commit

Permalink
fix(pipeline-builder): fix the reference header title have tooltip an…
Browse files Browse the repository at this point in the history
…d is able to copy (#958)

Because

- fix the reference header title have tooltip and is able to copy

This commit

- fix the reference header title have tooltip and is able to copy
  • Loading branch information
EiffelFly authored Feb 14, 2024
1 parent 0c6ef4e commit 6214838
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/toolkit/src/components/ReferenceHintTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ export const ReferenceHintTagIcon = ({
export const ReferenceHintTagLabel = ({
label,
className,
disabledTooltip,
disabledCopy,
}: {
label: string;
className?: string;
disabledTooltip?: boolean;
disabledCopy?: boolean;
}) => {
const [open, setOpen] = React.useState(false);
const [copied, setCopied] = React.useState(false);
Expand All @@ -56,6 +60,11 @@ export const ReferenceHintTagLabel = ({
<Tooltip.Root
open={open}
onOpenChange={(open) => {
if (disabledTooltip) {
setOpen(false);
return;
}

if (copied) {
return;
}
Expand All @@ -65,6 +74,10 @@ export const ReferenceHintTagLabel = ({
<Tooltip.Trigger asChild>
<button
onClick={async (e) => {
if (disabledCopy) {
return;
}

e.stopPropagation();
e.preventDefault();
await navigator.clipboard.writeText(label);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export const ComponentOutputReferenceHints = ({
<ReferenceHintTag.Label
label="references"
className="!text-semantic-fg-disabled"
disabledCopy={true}
disabledTooltip={true}
/>
</ReferenceHintTag.Root>
{/* <button
Expand Down

0 comments on commit 6214838

Please sign in to comment.