Skip to content

Commit 0f7f8ef

Browse files
Message thread appearance (#84)
Co-authored-by: me <me@kentcdodds.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 58e14ca commit 0f7f8ef

7 files changed

Lines changed: 271 additions & 288 deletions

File tree

app/components/search-bar.tsx

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ export function SearchBar({
2020
showDateFilter?: boolean
2121
}) {
2222
const id = useId()
23-
const dateId = `${id}-date`
23+
const startDateId = `${id}-start-date`
24+
const endDateId = `${id}-end-date`
2425
const [searchParams] = useSearchParams()
2526
const submit = useSubmit()
2627
const isSubmitting = useIsPending({
2728
formMethod: 'GET',
2829
formAction: action,
2930
})
30-
const dateValue = searchParams.get('date') ?? ''
31+
const startDateValue = searchParams.get('startDate') ?? ''
32+
const endDateValue = searchParams.get('endDate') ?? ''
3133

3234
const handleFormChange = useDebounce((form: HTMLFormElement) => {
3335
void submit(form)
@@ -55,17 +57,31 @@ export function SearchBar({
5557
/>
5658
</div>
5759
{showDateFilter ? (
58-
<div className="w-full sm:w-auto">
59-
<Label htmlFor={dateId} className="sr-only">
60-
Filter by date
61-
</Label>
62-
<Input
63-
type="date"
64-
name="date"
65-
id={dateId}
66-
defaultValue={dateValue}
67-
className="w-full"
68-
/>
60+
<div className="flex w-full flex-col gap-2 sm:w-auto sm:flex-row">
61+
<div className="w-full sm:w-[160px]">
62+
<Label htmlFor={startDateId} className="sr-only">
63+
Start date
64+
</Label>
65+
<Input
66+
type="date"
67+
name="startDate"
68+
id={startDateId}
69+
defaultValue={startDateValue}
70+
className="w-full"
71+
/>
72+
</div>
73+
<div className="w-full sm:w-[160px]">
74+
<Label htmlFor={endDateId} className="sr-only">
75+
End date
76+
</Label>
77+
<Input
78+
type="date"
79+
name="endDate"
80+
id={endDateId}
81+
defaultValue={endDateValue}
82+
className="w-full"
83+
/>
84+
</div>
6985
</div>
7086
) : null}
7187
<div>

app/routes/_app+/_layout.tsx

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useRef, useState } from 'react'
1+
import { useRef, useState, type CSSProperties } from 'react'
22
import {
33
Form,
44
Link,
@@ -67,40 +67,52 @@ export default function Layout() {
6767
const data = useLoaderData<typeof loader>()
6868
const user = useOptionalUser()
6969
const requestInfo = useRequestInfo()
70+
const isRecipientsRoute = requestInfo.path.startsWith('/recipients')
71+
const recipientsTheme = isRecipientsRoute
72+
? ({
73+
'--background': '0 0% 100%',
74+
'--card': '0 0% 100%',
75+
} as CSSProperties)
76+
: undefined
7077
return (
71-
<div className="flex h-screen flex-col justify-between">
72-
<header className="container py-5 md:py-6">
73-
<nav className="flex flex-wrap items-center justify-between gap-4 sm:flex-nowrap md:gap-8">
74-
<Logo />
75-
<div className="flex items-center gap-10">
76-
{user ? (
77-
<div className="flex gap-4">
78-
{data.isSubscribed ? null : (
79-
<Button variant="outline" asChild>
80-
<Link to="/settings/profile/subscription">
81-
Start your free trial
82-
</Link>
83-
</Button>
84-
)}
85-
<UserDropdown />
86-
</div>
87-
) : (
88-
<>
89-
<Button
90-
asChild
91-
variant="default"
92-
size="lg"
93-
className="hidden sm:inline-flex"
94-
>
95-
<Link to="/login">Log In</Link>
96-
</Button>
97-
<div className="sm:hidden">
98-
<MobileMenu />
78+
<div
79+
className="bg-background flex h-screen flex-col justify-between"
80+
style={recipientsTheme}
81+
>
82+
<header className="border-border border-b">
83+
<div className="container py-5 md:py-6">
84+
<nav className="flex flex-wrap items-center justify-between gap-4 sm:flex-nowrap md:gap-8">
85+
<Logo />
86+
<div className="flex items-center gap-10">
87+
{user ? (
88+
<div className="flex gap-4">
89+
{data.isSubscribed ? null : (
90+
<Button variant="outline" asChild>
91+
<Link to="/settings/profile/subscription">
92+
Start your free trial
93+
</Link>
94+
</Button>
95+
)}
96+
<UserDropdown />
9997
</div>
100-
</>
101-
)}
102-
</div>
103-
</nav>
98+
) : (
99+
<>
100+
<Button
101+
asChild
102+
variant="default"
103+
size="lg"
104+
className="hidden sm:inline-flex"
105+
>
106+
<Link to="/login">Log In</Link>
107+
</Button>
108+
<div className="sm:hidden">
109+
<MobileMenu />
110+
</div>
111+
</>
112+
)}
113+
</div>
114+
</nav>
115+
</div>
104116
</header>
105117
<div className="flex-1">
106118
<Outlet />

0 commit comments

Comments
 (0)