-
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
david emioma
committed
Mar 24, 2024
1 parent
a2f5800
commit fb09b1c
Showing
29 changed files
with
1,318 additions
and
380 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
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,25 @@ | ||
"use client"; | ||
|
||
import React from "react"; | ||
import Link from "next/link"; | ||
import Logo from "@/components/Logo"; | ||
import { ArrowLeft } from "lucide-react"; | ||
import Container from "@/components/Container"; | ||
|
||
const NavBar = () => { | ||
return ( | ||
<nav className="fixed top-0 inset-x-0 z-40 bg-white h-16 flex items-center border-b border-gray-200 shadow-sm"> | ||
<Container> | ||
<div className="flex items-center gap-5"> | ||
<Link href="/"> | ||
<ArrowLeft className="w-5 h-5" /> | ||
</Link> | ||
|
||
<Logo /> | ||
</div> | ||
</Container> | ||
</nav> | ||
); | ||
}; | ||
|
||
export default NavBar; |
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,16 +1,29 @@ | ||
"use client"; | ||
|
||
import { useEffect } from "react"; | ||
import useStoreModal from "@/hooks/use-store-modal"; | ||
import Container from "@/components/Container"; | ||
import StoreForm from "@/components/StoreForm"; | ||
import { | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardHeader, | ||
CardTitle, | ||
} from "@/components/ui/card"; | ||
|
||
export default function CreateStorePage() { | ||
const storeModal = useStoreModal(); | ||
return ( | ||
<Container> | ||
<Card className="w-full max-w-md mx-auto"> | ||
<CardHeader> | ||
<CardTitle>Become a seller</CardTitle> | ||
|
||
useEffect(() => { | ||
if (!storeModal.isOpen) { | ||
storeModal.onOpen(); | ||
} | ||
}, [storeModal.isOpen, storeModal.onOpen]); | ||
<CardDescription>Create your store.</CardDescription> | ||
</CardHeader> | ||
|
||
return null; | ||
<CardContent> | ||
<StoreForm /> | ||
</CardContent> | ||
</Card> | ||
</Container> | ||
); | ||
} |
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
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,49 @@ | ||
"use client"; | ||
|
||
import React, { useState } from "react"; | ||
import { useRouter } from "next/navigation"; | ||
import { XIcon, SearchIcon } from "lucide-react"; | ||
|
||
const SearchBar = () => { | ||
const router = useRouter(); | ||
|
||
const [value, setValue] = useState(""); | ||
|
||
const onSubmit = (e: React.FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
|
||
if (value.trim() === "") return; | ||
|
||
router.push(`/products/search?query=${value}`); | ||
}; | ||
|
||
return ( | ||
<form | ||
onSubmit={onSubmit} | ||
className="w-full h-10 bg-background flex gap-3 border border-input px-3 py-2 rounded-md text-sm ring-offset-background " | ||
> | ||
<input | ||
className="w-full flex-1 outline-none" | ||
placeholder="Search..." | ||
value={value} | ||
onChange={(e) => setValue(e.target.value)} | ||
/> | ||
|
||
{value.trim() && ( | ||
<button | ||
type="button" | ||
className="flex items-center justify-center" | ||
onClick={() => setValue("")} | ||
> | ||
<XIcon className="w-4 h-4" /> | ||
</button> | ||
)} | ||
|
||
<button type="submit" className="flex items-center justify-center"> | ||
<SearchIcon className="w-4 h-4" /> | ||
</button> | ||
</form> | ||
); | ||
}; | ||
|
||
export default SearchBar; |
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
66 changes: 66 additions & 0 deletions
66
app/(marketing)/products/[productId]/stores/[storeId]/_components/ProductFilters.tsx
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,66 @@ | ||
"use client"; | ||
|
||
import React, { useEffect, useState } from "react"; | ||
import qs from "query-string"; | ||
import { XIcon } from "lucide-react"; | ||
import { useRouter } from "next/navigation"; | ||
import { Input } from "@/components/ui/input"; | ||
|
||
type Props = { | ||
storeId: string; | ||
productId: string; | ||
}; | ||
|
||
const ProductFilters = ({ storeId, productId }: Props) => { | ||
const router = useRouter(); | ||
|
||
const [value, setValue] = useState(""); | ||
|
||
const [debounceValue, setDebounceValue] = useState(""); | ||
|
||
useEffect(() => { | ||
setTimeout(() => { | ||
setDebounceValue(value); | ||
}, 1000); | ||
}, [value]); | ||
|
||
useEffect(() => { | ||
const pushToUrl = () => { | ||
const url = qs.stringifyUrl( | ||
{ | ||
url: `/products/${productId}/stores/${storeId}`, | ||
query: { | ||
search: debounceValue, | ||
}, | ||
}, | ||
{ skipNull: true } | ||
); | ||
|
||
router.push(url); | ||
}; | ||
|
||
pushToUrl(); | ||
}, [debounceValue, productId, storeId]); | ||
|
||
return ( | ||
<div className="relative w-full max-w-96"> | ||
<Input | ||
className="w-full rounded-lg pr-6" | ||
placeholder="Search Product" | ||
value={value} | ||
onChange={(e) => setValue(e.target.value)} | ||
/> | ||
|
||
{value.trim() && ( | ||
<button | ||
className="absolute right-3 top-1/2 -translate-y-1/2" | ||
onClick={() => setValue("")} | ||
> | ||
<XIcon className="w-4 h-4" /> | ||
</button> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProductFilters; |
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
Oops, something went wrong.