-
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.
Merge pull request #318 from boostcampwm-2024/Feat/41
[Feat] 분야별 필터링 구현
- Loading branch information
Showing
5 changed files
with
91 additions
and
47 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,35 @@ | ||
import { Button } from '@/components/ui/button'; | ||
import { Field } from '@/types/liveTypes'; | ||
|
||
const fields: Field[] = ['WEB', 'AND', 'IOS']; | ||
|
||
interface FieldFilterProps { | ||
selectedField: Field; | ||
onFieldSelect: (field: Field) => void; | ||
} | ||
|
||
function FieldFilter({ selectedField, onFieldSelect }: FieldFilterProps) { | ||
const handleClick = (field: Field) => { | ||
onFieldSelect(selectedField === field ? '' : field); | ||
}; | ||
|
||
return ( | ||
<div className="flex flex-row justify-between gap-4"> | ||
{fields.map((field: Field) => ( | ||
<Button | ||
key={field} | ||
onClick={() => handleClick(field)} | ||
className={`${ | ||
selectedField === field | ||
? 'bg-surface-brand-default hover:bg-surface-point-alt' | ||
: 'bg-transparent border border-border-default hover:bg-surface-alt' | ||
}`} | ||
> | ||
{field} | ||
</Button> | ||
))} | ||
</div> | ||
); | ||
} | ||
|
||
export default FieldFilter; |
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,5 @@ | ||
function Search() { | ||
return <div className="bg-surface-alt w-52 h-10"></div>; | ||
} | ||
|
||
export default Search; |
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,37 +1,9 @@ | ||
import LiveList from '@pages/Home/LiveList'; | ||
import LoadingCharacter from '@components/LoadingCharacter'; | ||
import ErrorCharacter from '@components/ErrorCharacter'; | ||
import { useAPI } from '@hooks/useAPI'; | ||
import { LivePreviewListInfo } from '@/types/homeTypes'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
export default function Home() { | ||
const { data: liveListInfo, isLoading, error } = useAPI<LivePreviewListInfo>({ url: '/v1/broadcasts' }); | ||
const [showLoading, setShowLoading] = useState(false); | ||
|
||
useEffect(() => { | ||
const timer = setTimeout(() => { | ||
setShowLoading(true); | ||
}, 250); | ||
|
||
return () => clearTimeout(timer); | ||
}); | ||
|
||
return ( | ||
<div className="flex justify-center w-full h-full"> | ||
{error ? ( | ||
<div className="flex justify-center items-center flex-1"> | ||
<ErrorCharacter message={error.message} /> | ||
</div> | ||
) : isLoading && showLoading ? ( | ||
<div className="flex justify-center items-center flex-1"> | ||
<LoadingCharacter /> | ||
</div> | ||
) : liveListInfo?.broadcasts && liveListInfo.broadcasts.length > 0 ? ( | ||
<LiveList liveList={liveListInfo.broadcasts} /> | ||
) : ( | ||
<div className="h-full flex items-center">방송 중인 캠퍼가 없습니다.</div> | ||
)} | ||
<LiveList /> | ||
</div> | ||
); | ||
} |
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