Skip to content

Commit 50f1a4d

Browse files
committed
Cleaned up Header on Mobile
Right now I'm hiding the search/filter on small displays
1 parent cbc06d4 commit 50f1a4d

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

app/ui/header.tsx

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,50 @@
11
'use client';
22

3-
import { useEffect, useState } from 'react';
3+
import { useState, useEffect } from 'react';
44

55
interface HeaderProps {
66
onChange: (opts: { sort: string; query: string }) => void;
77
}
88

99
export default function Header({ onChange }: HeaderProps) {
10-
const [sort, setSort] = useState<'alpha' | 'date'>('alpha');
10+
const [sort, setSort] = useState<'alpha' | 'date'>('alpha');
1111
const [query, setQuery] = useState('');
1212

1313
useEffect(() => onChange({ sort, query }), [sort, query, onChange]);
1414

1515
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 */}
3219
<h1 className="text-lg sm:text-2xl font-bold tracking-wide whitespace-nowrap select-none">
3320
Jacob Robbins&rsquo; <span className="font-light">Skybox&nbsp;Library</span>
3421
</h1>
3522

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">
3825
{/* search */}
3926
<input
40-
placeholder="Search…"
4127
value={query}
4228
onChange={(e) => setQuery(e.target.value)}
29+
placeholder="Search…"
4330
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
4635
placeholder:text-neutral-500
4736
focus:outline-none focus:ring-2 focus:ring-amber-500
4837
"
4938
/>
5039

51-
{/* sort dropdown */}
40+
{/* sort */}
5241
<select
5342
value={sort}
5443
onChange={(e) => setSort(e.target.value as any)}
5544
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
5748
focus:outline-none focus:ring-2 focus:ring-amber-500
5849
"
5950
>

0 commit comments

Comments
 (0)