Skip to content

Commit d2f99cd

Browse files
committed
^react-tooltip + add channel tooltip
1 parent e037145 commit d2f99cd

4 files changed

Lines changed: 32 additions & 5 deletions

File tree

components/home/Server.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
import { Channel, Server as ServerType } from '@/types/dbtypes';
2121
import { useSetChannel } from '@/lib/store';
2222
import { ChannelMediaIcon } from '../icons/ChannelMediaIcon';
23+
import { Tooltip } from 'react-tooltip';
2324

2425
export default function Server({
2526
server,
@@ -84,7 +85,7 @@ export default function Server({
8485

8586
if (expand) {
8687
return (
87-
<div className="relative ">
88+
<div className="relative overflow-x-visible">
8889
<div className="border-b-2 border-grey-700 py-2 px-3 flex bg-grey-600 justify-between rounded-xl items-center relative z-10">
8990
<div className="flex items-center">
9091
<div
@@ -138,6 +139,8 @@ export default function Server({
138139
onMouseEnter={() => setIsSettingsHovered(true)}
139140
onMouseLeave={() => setIsSettingsHovered(false)}
140141
className="hover:cursor-pointer"
142+
data-tooltip-id="serverSettings"
143+
data-tooltip-place="right"
141144
>
142145
<VerticalSettingsIcon hovered={isSettingsHovered} />
143146
</div>

components/home/ServerList.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import styles from '@/styles/Servers.module.css';
77
import AddServerModal from '@/components/home/AddServerModal';
88
import { useGetServers, useServers } from '@/lib/store';
99
import { Tooltip } from 'react-tooltip';
10+
import PlusIcon from '@/components/icons/PlusIcon';
1011

1112
export default function ServerList() {
1213
//TODO: fetch server_users via profile id, select server_id -> fetch channels via this server_id && fetch servers with server_id
@@ -57,7 +58,8 @@ export default function ServerList() {
5758
style={{
5859
backgroundColor: '#21282b',
5960
borderRadius: '0.5rem',
60-
fontSize: '1rem',
61+
fontSize: '1.125rem',
62+
lineHeight: '1.75rem',
6163
}}
6264
id="addServer"
6365
clickable
@@ -73,7 +75,8 @@ export default function ServerList() {
7375
placeholder="Search"
7476
></input>
7577
</div>
76-
<div className="overflow-y-scroll">
78+
79+
<div className="overflow-y-scroll ">
7780
{servers &&
7881
servers.map((server, idx, serverList) => {
7982
if (server) {
@@ -97,6 +100,23 @@ export default function ServerList() {
97100
}
98101
})}
99102
</div>
103+
<Tooltip
104+
className="z-20 !opacity-100 font-semibold "
105+
style={{
106+
backgroundColor: '#21282b',
107+
borderRadius: '0.5rem',
108+
fontSize: '1.125rem',
109+
lineHeight: '1.75rem',
110+
}}
111+
id="serverSettings"
112+
clickable
113+
openOnClick={true}
114+
>
115+
<div className="flex justify-center items-center hover:text-grey-300 cursor-pointer">
116+
<PlusIcon width={5} height={5} />
117+
<span className="ml-1">New channel</span>
118+
</div>
119+
</Tooltip>
100120
</div>
101121
);
102122
}

components/icons/PlusIcon.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
export default function PlusIcon({
22
color = 'currentColor',
3+
width = 6,
4+
height = 6,
35
}: {
46
color?: string;
7+
width?: number;
8+
height?: number;
59
}) {
610
return (
711
<svg
812
xmlns="http://www.w3.org/2000/svg"
913
viewBox="0 0 24 24"
1014
fill={color}
11-
className="w-6 h-6"
15+
className={`w-${width} h-${height}`}
1216
>
1317
<path
1418
fillRule="evenodd"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"react-markdown": "^8.0.5",
4242
"react-responsive": "^9.0.2",
4343
"react-toastify": "^9.1.1",
44-
"react-tooltip": "^5.8.1",
44+
"react-tooltip": "^5.10.0",
4545
"rehype-highlight": "^6.0.0",
4646
"rehype-katex": "^6.0.2",
4747
"remark-breaks": "^3.0.2",

0 commit comments

Comments
 (0)