+
{children}
-
{content}
+
+ {isOpen && (
+
+ {content}
+
+ )}
+
);
}
diff --git a/components/NavBar/Tooltip/Tooltip.module.css b/components/NavBar/Tooltip/Tooltip.module.css
index 4e2fed9..ae0fd44 100644
--- a/components/NavBar/Tooltip/Tooltip.module.css
+++ b/components/NavBar/Tooltip/Tooltip.module.css
@@ -4,43 +4,38 @@
}
.tooltipContent {
- visibility: hidden;
- width: 100px;
+ position: absolute;
+ z-index: 1000;
+ top: calc(100% + 10px);
+ right: 0; /* Align to the right of the container */
background-color: white;
color: black;
- text-align: center;
border-radius: 8px;
- padding: 10px;
+ padding: 12px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
- position: absolute;
- z-index: 1;
- top: 120%; /* Position the tooltip below the text */
- left: 50%;
- transform: translateX(-50%);
- opacity: 0;
- transition: opacity 0.3s;
-}
-
-.tooltipContainer:hover .tooltipContent {
- visibility: visible;
- opacity: 1;
+ min-width: 150px; /* Ensure minimum width for content */
+ white-space: nowrap;
}
-.tooltipContent div {
- margin-bottom: 10px;
+.tooltipContent > div {
+ padding: 8px 0;
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
}
-.tooltipContent div:last-child {
- margin-bottom: 0;
+.tooltipContent > div:not(:last-child) {
+ border-bottom: 1px solid #e0e0e0;
}
.iconContainer {
display: flex;
justify-content: center;
align-items: center;
+ margin-left: auto; /* Push icon to the right */
}
.iconContainer img {
- width: 24px;
- height: 24px;
+ width: 20px;
+ height: 20px;
}
diff --git a/components/NavBar/UserLogged/UserLogged.tsx b/components/NavBar/UserLogged/UserLogged.tsx
index f5cae8f..a24b44e 100644
--- a/components/NavBar/UserLogged/UserLogged.tsx
+++ b/components/NavBar/UserLogged/UserLogged.tsx
@@ -1,20 +1,39 @@
-'use client';
+"use client";
-import { useUser } from '@/util/hooks';
-import Image from 'next/image';
-import styles from '../NavBar.module.css';
+import { useUser } from "@/util/hooks";
+import Image from "next/image";
+import moonSVG from "@/public/icons/moon.svg";
+import styles from "../NavBar.module.css";
+import Tooltip from "./../Tooltip/Tooltip";
+
+const tooltipContent = (
+ <>
+
Friends
+
Sign out
+
+
+
+ >
+);
export default function UserLogged() {
const user = useUser();
if (user?.osuId)
return (
-
-
-
+
+
+
+
+
);
}
From a222cb143989b8bf7ebd270dcb0cbe22d42916cc Mon Sep 17 00:00:00 2001
From: Tizzz-555 <103275021+Tizzz-555@users.noreply.github.com>
Date: Sun, 7 Jul 2024 13:31:54 +0200
Subject: [PATCH 03/10] improved style
---
components/NavBar/Tooltip/Tooltip.module.css | 35 +++++++++++++++-----
components/NavBar/UserLogged/UserLogged.tsx | 8 +++--
2 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/components/NavBar/Tooltip/Tooltip.module.css b/components/NavBar/Tooltip/Tooltip.module.css
index ae0fd44..ec1f5a1 100644
--- a/components/NavBar/Tooltip/Tooltip.module.css
+++ b/components/NavBar/Tooltip/Tooltip.module.css
@@ -7,13 +7,13 @@
position: absolute;
z-index: 1000;
top: calc(100% + 10px);
- right: 0; /* Align to the right of the container */
+ right: -44px;
background-color: white;
color: black;
border-radius: 8px;
padding: 12px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
- min-width: 150px; /* Ensure minimum width for content */
+ min-width: 120px;
white-space: nowrap;
}
@@ -21,21 +21,40 @@
padding: 8px 0;
display: flex;
align-items: center;
- justify-content: flex-start;
+ justify-content: center;
+}
+
+.tooltipContent > div > span {
+ cursor: pointer;
+ transition: color 0.2s ease, background-color 0.2s ease;
+ /* padding: 4px 8px; */
+ border-radius: 4px;
}
-.tooltipContent > div:not(:last-child) {
- border-bottom: 1px solid #e0e0e0;
+.tooltipContent > div > span:hover {
+ color: #888;
}
-.iconContainer {
+/* .iconContainer {
display: flex;
justify-content: center;
align-items: center;
- margin-left: auto; /* Push icon to the right */
+ margin-left: auto;
+ cursor: pointer;
+ transition: filter 0.2s ease;
+ padding: 4px;
+ border-radius: 4px;
+}
+
+.iconContainer:hover {
+ background-color: #f0f0f0;
+}
+
+.iconContainer:hover img {
+ filter: brightness(1.5);
}
.iconContainer img {
width: 20px;
height: 20px;
-}
+} */
diff --git a/components/NavBar/UserLogged/UserLogged.tsx b/components/NavBar/UserLogged/UserLogged.tsx
index a24b44e..e83d1df 100644
--- a/components/NavBar/UserLogged/UserLogged.tsx
+++ b/components/NavBar/UserLogged/UserLogged.tsx
@@ -8,8 +8,12 @@ import Tooltip from "./../Tooltip/Tooltip";
const tooltipContent = (
<>
-
Friends
-
Sign out
+
+ Friends
+
+
+ Sign out
+
Date: Sun, 14 Jul 2024 16:24:02 +0200
Subject: [PATCH 04/10] moved theme switcher into tooltip
---
components/NavBar/NavBar.tsx | 14 ++-------
.../NavBar/ThemeSwitcher/ThemeSwitcher.tsx | 29 ++++++++-----------
components/NavBar/Tooltip/Tooltip.module.css | 25 ----------------
components/NavBar/UserLogged/UserLogged.tsx | 10 ++-----
4 files changed, 16 insertions(+), 62 deletions(-)
diff --git a/components/NavBar/NavBar.tsx b/components/NavBar/NavBar.tsx
index 88a0f92..014a20e 100644
--- a/components/NavBar/NavBar.tsx
+++ b/components/NavBar/NavBar.tsx
@@ -10,7 +10,6 @@ import ModeSwitcher from "./ModeSwitcher/ModeSwitcher";
import styles from "./NavBar.module.css";
import Routes from "./Routes/Routes";
import SearchButton from "./SearchButton/SearchButton";
-import ThemeSwitcher from "./ThemeSwitcher/ThemeSwitcher";
import UserLogged from "./UserLogged/UserLogged";
export default function NavBar() {
@@ -25,15 +24,8 @@ export default function NavBar() {
return (