From 4e800389973be23b6ddbf946ff1eea2c55d0bc74 Mon Sep 17 00:00:00 2001 From: Sinclair Chen Date: Thu, 11 Aug 2022 19:32:38 -0700 Subject: [PATCH] Show tooltip on tap for touch devices Except tooltips on buttons --- web/components/datetime-tooltip.tsx | 9 ++++-- web/components/feed/copy-link-date-time.tsx | 2 +- web/components/tipper.tsx | 2 ++ web/components/tooltip.tsx | 33 +++++++++++++-------- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/web/components/datetime-tooltip.tsx b/web/components/datetime-tooltip.tsx index b6310672..7aaf61aa 100644 --- a/web/components/datetime-tooltip.tsx +++ b/web/components/datetime-tooltip.tsx @@ -12,11 +12,16 @@ export function DateTimeTooltip(props: { time: number text?: string children?: React.ReactNode + noTap?: boolean }) { - const { time, text } = props + const { time, text, noTap } = props const formattedTime = dayjs(time).format('MMM DD, YYYY hh:mm a z') const toolTip = text ? `${text} ${formattedTime}` : formattedTime - return {props.children} + return ( + + {props.children} + + ) } diff --git a/web/components/feed/copy-link-date-time.tsx b/web/components/feed/copy-link-date-time.tsx index 89e94816..cea8300a 100644 --- a/web/components/feed/copy-link-date-time.tsx +++ b/web/components/feed/copy-link-date-time.tsx @@ -30,7 +30,7 @@ export function CopyLinkDateTimeComponent(props: { } return (
- + copyLinkToComment(event)} diff --git a/web/components/tipper.tsx b/web/components/tipper.tsx index c35cf965..dbacbee9 100644 --- a/web/components/tipper.tsx +++ b/web/components/tipper.tsx @@ -106,6 +106,7 @@ function DownTip(props: { onClick?: () => void }) { className="h-6 w-6" placement="bottom" text={onClick && `-${formatMoney(5)}`} + noTap >