File tree Expand file tree Collapse file tree 3 files changed +60
-6
lines changed
web/src/modules/shared/components/layout Expand file tree Collapse file tree 3 files changed +60
-6
lines changed Original file line number Diff line number Diff line change
1
+ 'use client' ;
2
+ import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons' ;
3
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
4
+ import { cn } from '@web/src/lib/tailwind.utils' ;
5
+ import { useState } from 'react' ;
6
+ import { Popover , PopoverContent , PopoverTrigger } from './popover' ;
7
+
8
+ export const BlockSearch = ( ) => {
9
+ const [ query , setQuery ] = useState ( '' ) ;
10
+
11
+ return (
12
+ < Popover >
13
+ < PopoverTrigger
14
+ className = { cn (
15
+ 'bevel p-2 flex-1 w-8 md:min-w-20 max-w-28 flex items-center justify-center gap-2 bg-zinc-600 after:bg-zinc-800 before:bg-zinc-900 translate-y-[11px] hover:translate-y-1.5 transition-all duration-150 hover:brightness-125' ,
16
+ ) }
17
+ id = { 'search-button' }
18
+ >
19
+ < FontAwesomeIcon icon = { faMagnifyingGlass } />
20
+ < span className = 'hidden sm:block' > Search</ span >
21
+ </ PopoverTrigger >
22
+ < PopoverContent className = 'w-fit p-[2px] pb-1.5 h-fit shadow-[inset_0px_0px_0px_2px_rgb(82_82_91)] drop-shadow-lg border-zinc-600 bg-zinc-800 text-white rounded-lg' >
23
+ < div className = 'flex flex-row gap-2 p-4' >
24
+ < input
25
+ type = 'text'
26
+ value = { query }
27
+ onChange = { ( e ) => setQuery ( e . target . value ) }
28
+ placeholder = 'Search for songs and users'
29
+ className = 'w-full bg-zinc-800 text-white border border-zinc-600 rounded-md p-2'
30
+ />
31
+ < button
32
+ className = 'bg-zinc-600 text-white rounded-md p-2 hover:bg-zinc-500 w-12 h-12'
33
+ onClick = { ( ) => {
34
+ console . log ( 'Searching for:' , query ) ;
35
+ } }
36
+ >
37
+ < FontAwesomeIcon icon = { faMagnifyingGlass } />
38
+ </ button >
39
+ </ div >
40
+ </ PopoverContent >
41
+ </ Popover >
42
+ ) ;
43
+ } ;
Original file line number Diff line number Diff line change @@ -4,24 +4,29 @@ import Link from 'next/link';
4
4
5
5
import { cn } from '@web/src/lib/tailwind.utils' ;
6
6
7
+ interface BlockTabProps {
8
+ href : string ;
9
+ icon : IconDefinition ;
10
+ label : string ;
11
+ className ?: string ;
12
+ id ?: string ;
13
+ }
14
+
7
15
export const BlockTab = ( {
16
+ id,
8
17
href,
9
18
icon,
10
19
label,
11
20
className,
12
- } : {
13
- href : string ;
14
- icon : IconDefinition ;
15
- label : string ;
16
- className ?: string ;
17
- } ) => {
21
+ } : BlockTabProps ) => {
18
22
return (
19
23
< Link
20
24
href = { href }
21
25
className = { cn (
22
26
'bevel p-2 flex-1 w-8 md:min-w-20 max-w-28 flex items-center justify-center gap-2 bg-zinc-600 after:bg-zinc-800 before:bg-zinc-900 translate-y-[11px] hover:translate-y-1.5 transition-all duration-150 hover:brightness-125' ,
23
27
className ,
24
28
) }
29
+ id = { id }
25
30
>
26
31
< FontAwesomeIcon icon = { icon } />
27
32
< span className = 'hidden sm:block' > { label } </ span >
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import {
16
16
import { BlockTab } from './BlockTab' ;
17
17
import { NavLinks } from './NavLinks' ;
18
18
import { RandomSongButton } from './RandomSongButton' ;
19
+ import { BlockSearch } from './BlockSearchProps' ;
19
20
20
21
export async function Header ( ) {
21
22
let isLogged ;
@@ -77,26 +78,31 @@ export async function Header() {
77
78
icon = { faMusic }
78
79
label = 'Songs'
79
80
className = 'bg-purple-700 after:bg-purple-900 before:bg-purple-950'
81
+ id = 'songs-tab'
80
82
/>
81
83
< BlockTab
82
84
href = '/help'
83
85
icon = { faQuestionCircle }
84
86
label = 'Help'
85
87
className = 'bg-blue-700 after:bg-blue-900 before:bg-blue-950'
88
+ id = 'help-tab'
86
89
/>
87
90
< BlockTab
88
91
href = '/blog'
89
92
icon = { faNewspaper }
90
93
label = 'Blog'
91
94
className = 'bg-green-700 after:bg-green-900 before:bg-green-950'
95
+ id = 'blog-tab'
92
96
/>
93
97
< BlockTab
94
98
href = '/about'
95
99
icon = { faUser }
96
100
label = 'About'
97
101
className = 'bg-cyan-700 after:bg-cyan-900 before:bg-cyan-950'
102
+ id = 'about-tab'
98
103
/>
99
104
< RandomSongButton />
105
+ < BlockSearch />
100
106
</ div >
101
107
102
108
{ /* Sign in / Profile */ }
You can’t perform that action at this time.
0 commit comments