-
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.
[Add] 알림 눌렀을 때 상세페이지에 정보 맵핑해서 보여줌 #86
- 상세페이지 눌렀을 때 feedId에 따라 정보 보여줌 - 바탕 클릭시 모달 꺼짐
- Loading branch information
1 parent
de11d38
commit 001c9e3
Showing
8 changed files
with
128 additions
and
38 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,37 +1,48 @@ | ||
import React from 'react'; | ||
import CommonModal from './CommonModal'; | ||
import Feed from '../Feed/Feed'; | ||
import { useGetfeedsQuery } from 'react-components.d'; | ||
import { useGetfeedQuery } from 'react-components.d'; | ||
import { getDate } from 'utils/dateUtil'; | ||
import styled from 'styled-components'; | ||
|
||
const ModalFeed = styled(Feed)` | ||
border: none; | ||
border-radius: 0px; | ||
`; | ||
const DetailFeed: React.FC = () => { | ||
const { data } = useGetfeedsQuery({ | ||
variables: { first: 1, currentCursor: '9999-12-31T09:29:26.050Z' } | ||
interface Iprops { | ||
isOpen: boolean; | ||
feedId: number; | ||
closeModal: () => void; | ||
} | ||
const DetailFeed = ({ isOpen, feedId, closeModal }: Iprops) => { | ||
const { data } = useGetfeedQuery({ | ||
variables: { feedId: feedId && Number(feedId) } | ||
}); | ||
|
||
const valuecheck = () => { | ||
return data && data.feeds && data.feeds.feedItems | ||
? data.feeds.feedItems.map((feed, idx) => { | ||
return feed && feed.feed && feed.feed.createdAt ? ( | ||
<ModalFeed | ||
key={getDate(feed.feed.createdAt).toISOString() + idx} | ||
content={feed.feed.content} | ||
feedinfo={feed} | ||
createdAt={getDate(feed.feed.createdAt).toISOString()} | ||
feedSize={'30rem'} | ||
/> | ||
) : ( | ||
<></> | ||
); | ||
}) | ||
: ''; | ||
const feed = data && data.feed; | ||
return ( | ||
feed && | ||
feed.feed && | ||
feed.feed.createdAt && ( | ||
<ModalFeed | ||
key={getDate(feed.feed.createdAt).toISOString()} | ||
content={feed.feed.content} | ||
feedinfo={feed} | ||
createdAt={getDate(feed.feed.createdAt).toISOString()} | ||
feedSize={'30rem'} | ||
/> | ||
) | ||
); | ||
}; | ||
return <CommonModal textChildren={valuecheck()} imageChildren={<></>} />; | ||
return ( | ||
<CommonModal | ||
isOpen={isOpen} | ||
textChildren={valuecheck()} | ||
imageChildren={<></>} | ||
closeModal={closeModal} | ||
/> | ||
); | ||
}; | ||
|
||
export default DetailFeed; |
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 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