From 9e2bbf4bebe66b085f3b6e55c97ba317ce69797e Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 2 Aug 2023 21:41:07 -0400 Subject: [PATCH] Add a simple tooltip to the sidebar (#6295) ## Summary Not perfect, but IMO helpful: Screen Shot 2023-08-02 at 9 29 24 PM Screen Shot 2023-08-02 at 9 29 20 PM --- playground/src/Editor/PrimarySideBar.tsx | 2 ++ playground/src/Editor/SecondarySideBar.tsx | 4 ++++ playground/src/Editor/ShareButton.tsx | 4 +--- playground/src/Editor/SideBar.tsx | 26 ++++++++++++++++++++-- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/playground/src/Editor/PrimarySideBar.tsx b/playground/src/Editor/PrimarySideBar.tsx index f4be0292d6..de4db82b0b 100644 --- a/playground/src/Editor/PrimarySideBar.tsx +++ b/playground/src/Editor/PrimarySideBar.tsx @@ -16,6 +16,7 @@ export default function PrimarySideBar({ onSelectTool("Source")} selected={selected == "Source"} > @@ -24,6 +25,7 @@ export default function PrimarySideBar({ onSelectTool("Settings")} selected={selected == "Settings"} > diff --git a/playground/src/Editor/SecondarySideBar.tsx b/playground/src/Editor/SecondarySideBar.tsx index 721f6fec25..8cece6e0ce 100644 --- a/playground/src/Editor/SecondarySideBar.tsx +++ b/playground/src/Editor/SecondarySideBar.tsx @@ -20,6 +20,7 @@ export default function SecondarySideBar({ onSelected(SecondaryTool.Format)} > @@ -28,6 +29,7 @@ export default function SecondarySideBar({ onSelected(SecondaryTool.AST)} > @@ -36,6 +38,7 @@ export default function SecondarySideBar({ onSelected(SecondaryTool.Tokens)} > @@ -44,6 +47,7 @@ export default function SecondarySideBar({ onSelected(SecondaryTool.FIR)} > diff --git a/playground/src/Editor/ShareButton.tsx b/playground/src/Editor/ShareButton.tsx index 0968c1b4cb..4938639e50 100644 --- a/playground/src/Editor/ShareButton.tsx +++ b/playground/src/Editor/ShareButton.tsx @@ -22,9 +22,7 @@ export default function ShareButton({ onShare }: { onShare?: () => void }) { > Share - - Copied! - + Copied! ) : ( @@ -45,6 +48,25 @@ export function SideBarEntry({ {selected && ( )} + + {title} ); } + +interface TooltipProps { + children: ReactNode; + position: "left" | "right"; +} + +function Tooltip({ children, position }: TooltipProps) { + return ( + + ); +}