-
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
Showing
10 changed files
with
147 additions
and
114 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,37 +1,50 @@ | ||
import React from 'react'; | ||
import React, { useEffect, useState } from 'react'; | ||
import SearchYoutube from '@/components/Home/SearchYoutube'; | ||
import { | ||
HomePageContainer | ||
} from '@/styles/HomepageStyle'; | ||
import { HomePageContainer } from '@/styles/HomepageStyle'; | ||
import RecentVideos from '@/components/Home/RecentVideos'; | ||
import InsightVideos from '@/components/Home/InsightVideos'; | ||
import { useRecoilValue } from 'recoil'; | ||
import { recommendationModalState } from '@/stores/modal'; | ||
import RecommendationModal from '@/components/modals/RecommendationModal'; | ||
import { getRecentVideos } from '@/apis/videos'; | ||
import { userTokenState } from '@/stores/user'; | ||
import { IVideoProps } from 'types/videos'; | ||
|
||
export interface Video { | ||
id: string; | ||
title: string; | ||
subtitle: string; | ||
hashtags: string[]; | ||
thumbnailUrl: string; | ||
thumbnailUrl: string; | ||
} | ||
|
||
const HomePage: React.FC = () => { | ||
const userToken = useRecoilValue(userTokenState); | ||
const [videos, setVideos] = useState<IVideoProps[]>([]); | ||
const handleSearch = (value: string) => { | ||
console.log(value); | ||
}; | ||
|
||
const isModalOpen = useRecoilValue(recommendationModalState); | ||
|
||
useEffect(() => { | ||
userToken && | ||
getRecentVideos() | ||
.then((res) => setVideos(res.result.videos)) | ||
.catch((err) => console.log(err)); | ||
}, [userToken]); | ||
|
||
return ( | ||
<HomePageContainer> | ||
<SearchYoutube onSearch={handleSearch} /> | ||
{isModalOpen && <RecommendationModal /> } | ||
<RecentVideos /> | ||
<InsightVideos username="여울" popularHashtags={['디자인', '진로', '브랜딩']} /> | ||
{isModalOpen && <RecommendationModal />} | ||
<RecentVideos videos={videos} /> | ||
<InsightVideos | ||
username="여울" | ||
popularHashtags={['디자인', '진로', '브랜딩']} | ||
/> | ||
</HomePageContainer> | ||
); | ||
}; | ||
|
||
export default HomePage; | ||
export default HomePage; |
Oops, something went wrong.