Skip to content

Commit

Permalink
fix: changed tooltip position on playground to improve visibility, fi…
Browse files Browse the repository at this point in the history
…xed color of theme switcher on light mode (#4766)

* Implemented avoidCollisions on ShadTooltip

* Added type for avoidCollisions

* Changed tooltip position for buttons on IOModal

* Fix color of light theme switcher
  • Loading branch information
lucaseduoli authored Nov 22, 2024
1 parent 3160c54 commit f0febbc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const ThemeButtons = () => {
className={`relative z-10 inline-flex items-center rounded-full px-1 ${
selectedTheme === "light"
? "text-foreground"
: "text-foreground hover:text-background dark:hover:bg-amber-400"
: "text-foreground hover:bg-amber-400 hover:text-background"
}`}
onClick={() => handleThemeChange("light")}
>
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/src/components/shadTooltipComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const ShadTooltip: React.FC<ShadToolTipType> = ({
open,
align,
setOpen,
avoidCollisions = false,
}) => {
if (!content) {
return <>{children}</>;
Expand All @@ -32,7 +33,7 @@ const ShadTooltip: React.FC<ShadToolTipType> = ({
styleClasses,
)}
side={side}
avoidCollisions={false}
avoidCollisions={avoidCollisions}
align={align}
sticky="always"
>
Expand Down
7 changes: 6 additions & 1 deletion src/frontend/src/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ const DialogContent = React.forwardRef<
{...props}
>
{children}
<ShadTooltip styleClasses="z-50" side="left" content="Close">
<ShadTooltip
styleClasses="z-50"
content="Close"
side="bottom"
avoidCollisions
>
<DialogPrimitive.Close className="absolute right-2 top-2 flex h-8 w-8 items-center justify-center rounded-sm ring-offset-background transition-opacity hover:bg-secondary-hover hover:text-accent-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<Cross2Icon className="h-[18px] w-[18px]" />
<span className="sr-only">Close</span>
Expand Down
6 changes: 5 additions & 1 deletion src/frontend/src/modals/IOModal/newModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,11 @@ export default function IOModal({
"absolute right-12 top-2 flex h-8 items-center justify-center rounded-sm ring-offset-background transition-opacity focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
)}
>
<ShadTooltip styleClasses="z-50" content="New Chat">
<ShadTooltip
side="bottom"
styleClasses="z-50"
content="New Chat"
>
<Button
className="mr-2 h-[32px] w-[32px] hover:bg-secondary-hover"
variant="ghost"
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/types/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ export type ShadToolTipType = {
children?: ReactElement;
delayDuration?: number;
styleClasses?: string;
avoidCollisions?: boolean;
};

export type TextHighlightType = {
Expand Down

0 comments on commit f0febbc

Please sign in to comment.