Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: place tooltip of article's "copy" button on the left #408

Merged
merged 3 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion resources/js/Components/Clipboard/Clipboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import cn from "classnames";
import { type HTMLAttributes, useRef } from "react";
import { useTranslation } from "react-i18next";

import { type ReferenceElement } from "tippy.js";
import { type Placement, type ReferenceElement } from "tippy.js";
import { Icon } from "@/Components/Icon";
import { Tooltip } from "@/Components/Tooltip";
import { useBreakpoint } from "@/Hooks/useBreakpoint";
Expand All @@ -14,6 +14,7 @@ export interface ClipboardProperties extends HTMLAttributes<HTMLDivElement> {
copiedIconClass?: string;
copiedIcon?: React.ReactNode;
zIndex?: number;
tooltipPlacement?: Placement;
}

export const Clipboard = ({
Expand All @@ -24,6 +25,7 @@ export const Clipboard = ({
copiedIconClass,
copiedIcon,
zIndex,
tooltipPlacement,
}: ClipboardProperties): JSX.Element => {
const { t } = useTranslation();
const reference = useRef<(ReferenceElement & HTMLDivElement) | null>(null);
Expand All @@ -44,6 +46,7 @@ export const Clipboard = ({
trigger={!isLgAndAbove ? "click" : "mouseenter focus"}
hideAfter={!isLgAndAbove ? 1000 : undefined}
zIndex={zIndex}
placement={tooltipPlacement}
touch
>
<div
Expand Down
1 change: 1 addition & 0 deletions resources/js/Pages/Articles/Components/ArticleCopy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const ArticleCopy = ({ article }: Properties): JSX.Element => {
<Clipboard
text={url}
copiedIconClass="group button-icon"
tooltipPlacement="left"
>
<IconButton icon="Copy" />
</Clipboard>
Expand Down
Loading