-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jared Brown
authored and
Jared Brown
committed
Apr 30, 2023
1 parent
f915f3e
commit 9ac47e0
Showing
3 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use client' | ||
|
||
import { useRouter } from "next/navigation"; | ||
|
||
import Heading from "./Heading"; | ||
import Button from "./Button"; | ||
|
||
interface EmptyState { | ||
title?: string; | ||
subtitle?: string; | ||
showReset?: boolean; | ||
} | ||
|
||
const EmptyState: React.FC<EmptyState> = ({ | ||
title= "No exact matches", | ||
subtitle = "Try changing or removing some of your filters", | ||
showReset | ||
}) => { | ||
const router = useRouter() | ||
|
||
return <div className="h-[60vh] flex flex-col gap-2 justify-center items-center"><Heading center title={title} subtitle={subtitle} /> | ||
<div className="w-48 mt-4"> | ||
{showReset && ( | ||
<Button outline label="Remove all filters" onClick={() => router.push('/')} /> | ||
)} | ||
</div> | ||
</div>; | ||
} | ||
|
||
export default EmptyState; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
import Container from "./components/Container"; | ||
import EmptyState from "./components/EmptyState"; | ||
|
||
export default function Home() { | ||
return <div className="text-rose-500 text-2xl">Hello Airbnb!</div>; | ||
const isEmpty = true; | ||
|
||
if (isEmpty) { | ||
return <EmptyState showReset /> | ||
} | ||
|
||
return ( | ||
<Container> | ||
<div className="pt-24 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-8"> | ||
<div> | ||
My future listings | ||
</div> | ||
</div> | ||
</Container> | ||
) | ||
} |