|
1 | 1 | 'use client';
|
2 | 2 |
|
3 |
| -import { useEffect, useState } from 'react'; |
| 3 | +import { useState, useEffect } from 'react'; |
4 | 4 |
|
5 | 5 | interface HeaderProps {
|
6 | 6 | onChange: (opts: { sort: string; query: string }) => void;
|
7 | 7 | }
|
8 | 8 |
|
9 | 9 | export default function Header({ onChange }: HeaderProps) {
|
10 |
| - const [sort, setSort] = useState<'alpha' | 'date'>('alpha'); |
| 10 | + const [sort, setSort] = useState<'alpha' | 'date'>('alpha'); |
11 | 11 | const [query, setQuery] = useState('');
|
12 | 12 |
|
13 | 13 | useEffect(() => onChange({ sort, query }), [sort, query, onChange]);
|
14 | 14 |
|
15 | 15 | return (
|
16 |
| - <header |
17 |
| - className=" |
18 |
| - sticky top-0 z-40 |
19 |
| - backdrop-blur-md bg-neutral-900/70 |
20 |
| - border-b border-neutral-800/60 |
21 |
| - " |
22 |
| - > |
23 |
| - <div |
24 |
| - className=" |
25 |
| - mx-auto max-w-6xl |
26 |
| - flex items-center justify-between |
27 |
| - px-4 sm:px-6 |
28 |
| - h-16 |
29 |
| - " |
30 |
| - > |
31 |
| - {/* site title */} |
| 16 | + <header className="sticky top-0 z-40 backdrop-blur-md bg-neutral-900/70 border-b border-neutral-800/60"> |
| 17 | + <div className="mx-auto max-w-6xl flex items-center justify-between px-4 sm:px-6 h-16"> |
| 18 | + {/* title */} |
32 | 19 | <h1 className="text-lg sm:text-2xl font-bold tracking-wide whitespace-nowrap select-none">
|
33 | 20 | Jacob Robbins’ <span className="font-light">Skybox Library</span>
|
34 | 21 | </h1>
|
35 | 22 |
|
36 |
| - {/* right-side controls */} |
37 |
| - <div className="flex items-center gap-3"> |
| 23 | + {/* controls */} |
| 24 | + <div className="hidden sm:flex items-center gap-3 w-full sm:w-auto"> |
38 | 25 | {/* search */}
|
39 | 26 | <input
|
40 |
| - placeholder="Search…" |
41 | 27 | value={query}
|
42 | 28 | onChange={(e) => setQuery(e.target.value)}
|
| 29 | + placeholder="Search…" |
43 | 30 | className="
|
44 |
| - w-32 sm:w-48 |
45 |
| - rounded-md bg-neutral-800/70 px-3 py-1.5 text-sm |
| 31 | + flex-auto min-w-0 |
| 32 | + w-48 |
| 33 | + rounded-md bg-neutral-800/70 |
| 34 | + px-3 py-1.5 text-sm |
46 | 35 | placeholder:text-neutral-500
|
47 | 36 | focus:outline-none focus:ring-2 focus:ring-amber-500
|
48 | 37 | "
|
49 | 38 | />
|
50 | 39 |
|
51 |
| - {/* sort dropdown */} |
| 40 | + {/* sort */} |
52 | 41 | <select
|
53 | 42 | value={sort}
|
54 | 43 | onChange={(e) => setSort(e.target.value as any)}
|
55 | 44 | className="
|
56 |
| - rounded-md bg-neutral-800/70 px-3 py-1.5 text-sm |
| 45 | + flex-none |
| 46 | + rounded-md bg-neutral-800/70 |
| 47 | + px-3 py-1.5 text-sm |
57 | 48 | focus:outline-none focus:ring-2 focus:ring-amber-500
|
58 | 49 | "
|
59 | 50 | >
|
|
0 commit comments