-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
3a6420b
commit 9abe5e9
Showing
4 changed files
with
175 additions
and
14 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 |
---|---|---|
@@ -1,9 +1,49 @@ | ||
import React from 'react' | ||
"use client"; | ||
|
||
import Image from "next/image"; | ||
import { useRouter } from "next/navigation"; | ||
|
||
import { Button } from "../ui/button"; | ||
|
||
interface Props { | ||
id: string; | ||
name: string; | ||
username: string; | ||
imgUrl: string; | ||
} | ||
|
||
function UserCard({ id, name, username, imgUrl}: Props) { | ||
const router = useRouter(); | ||
|
||
const UserCard = () => { | ||
return ( | ||
<div>UserCard</div> | ||
) | ||
<article className='user-card'> | ||
<div className='user-card_avatar'> | ||
<div className='relative h-12 w-12'> | ||
<Image | ||
src={imgUrl} | ||
alt='user_logo' | ||
fill | ||
className='rounded-full object-cover' | ||
/> | ||
</div> | ||
|
||
<div className='flex-1 text-ellipsis'> | ||
<h4 className='text-base-semibold text-light-1'>{name}</h4> | ||
<p className='text-small-medium text-gray-1'>@{username}</p> | ||
</div> | ||
</div> | ||
|
||
<Button | ||
className='user-card_btn' | ||
onClick={() => { | ||
router.push(`/profile/${id}`); | ||
|
||
}} | ||
> | ||
View | ||
</Button> | ||
</article> | ||
); | ||
} | ||
|
||
export default UserCard | ||
export default UserCard; |
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,9 +1,52 @@ | ||
import React from 'react' | ||
"use client"; | ||
|
||
import Image from "next/image"; | ||
import { useRouter } from "next/navigation"; | ||
import { useEffect, useState } from "react"; | ||
|
||
import { Input } from "../ui/input"; | ||
|
||
interface Props { | ||
routeType: string; | ||
} | ||
|
||
function Searchbar({ routeType }: Props) { | ||
const router = useRouter(); | ||
const [search, setSearch] = useState(""); | ||
|
||
// query after 0.3s of no input | ||
useEffect(() => { | ||
const delayDebounceFn = setTimeout(() => { | ||
if (search) { | ||
router.push(`/${routeType}?q=` + search); | ||
} else { | ||
router.push(`/${routeType}`); | ||
} | ||
}, 300); | ||
|
||
return () => clearTimeout(delayDebounceFn); | ||
}, [search, routeType]); | ||
|
||
const Searchbar = () => { | ||
return ( | ||
<div>Searchbar</div> | ||
) | ||
<div className='searchbar'> | ||
<Image | ||
src='/assets/search-gray.svg' | ||
alt='search' | ||
width={24} | ||
height={24} | ||
className='object-contain' | ||
/> | ||
<Input | ||
id='text' | ||
value={search} | ||
onChange={(e) => setSearch(e.target.value)} | ||
placeholder={`${ | ||
routeType !== "/search" ? "Search Users" : "Search creators" | ||
}`} | ||
className='no-focus searchbar_input' | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
export default Searchbar | ||
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