-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
15 changed files
with
244 additions
and
25 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
47 changes: 47 additions & 0 deletions
47
src/presentation/components/common/BottomSheet/NeososeoPicker/index.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,47 @@ | ||
import React from 'react'; | ||
import { api } from '@api/index'; | ||
import { icPick, icTrash } from '@assets/icons'; | ||
import { useToast } from '@hooks/useToast'; | ||
import BottomSheet from '..'; | ||
|
||
type NeososeoPickerBottomSheetProps = { | ||
opened: boolean; | ||
close: () => void; | ||
isPinned: boolean; | ||
id: number; | ||
}; | ||
|
||
function NeososeoPickerBottomSheet(props: NeososeoPickerBottomSheetProps) { | ||
const { opened, close, isPinned, id } = props; | ||
const { fireToast } = useToast(); | ||
|
||
const bookmarkAnswer = async () => { | ||
const response = await api.neogaService.postAnswerBookmark(id); | ||
if (response.isSuccess) { | ||
if (isPinned) fireToast({ content: '픽한 답변 삭제 완료' }); | ||
else fireToast({ content: 'MY에서 픽한 피드백을 확인할 수 있어요' }); | ||
close(); | ||
} | ||
}; | ||
|
||
const removeAnswer = async () => { | ||
const response = await api.neogaService.deleteAnswer(id); | ||
if (response.isSuccess) { | ||
fireToast({ content: '삭제 완료' }); | ||
close(); | ||
} | ||
}; | ||
|
||
return ( | ||
<BottomSheet | ||
buttonList={[ | ||
{ icon: icPick, label: isPinned ? '픽 취소하기' : '픽 하기', onClick: bookmarkAnswer }, | ||
{ icon: icTrash, label: '삭제하기', onClick: removeAnswer }, | ||
]} | ||
closeBottomSheet={close} | ||
isOpened={opened} | ||
/> | ||
); | ||
} | ||
|
||
export default NeososeoPickerBottomSheet; |
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,54 @@ | ||
import { useState } from 'react'; | ||
import { | ||
StAbsoluteWrapper, | ||
StBlackBlur, | ||
StWrapper, | ||
StButton, | ||
StCancelButton, | ||
StButtonWrapper, | ||
} from './style'; | ||
|
||
type BottomSheetButton = { | ||
icon: string; | ||
label: string; | ||
onClick: () => void; | ||
}; | ||
|
||
type BottomSheetProps = { | ||
isOpened: boolean; | ||
buttonList: BottomSheetButton[]; | ||
closeBottomSheet: () => void; | ||
}; | ||
|
||
function BottomSheet(props: BottomSheetProps) { | ||
const { buttonList: buttons, isOpened: opened, closeBottomSheet: close } = props; | ||
const [isClosing, setIsClosing] = useState(false); | ||
const closeModal = () => { | ||
setIsClosing(true); | ||
setTimeout(() => { | ||
close(); | ||
setIsClosing(false); | ||
}, 1000); | ||
}; | ||
|
||
return opened ? ( | ||
<StAbsoluteWrapper> | ||
<StBlackBlur onClick={closeModal} isClosing={isClosing} /> | ||
<StWrapper isClosing={isClosing}> | ||
<StButtonWrapper> | ||
{buttons.map((button) => ( | ||
<StButton onClick={button.onClick} key={button.label}> | ||
<img src={button.icon} alt={button.label} /> | ||
<div>{button.label}</div> | ||
</StButton> | ||
))} | ||
</StButtonWrapper> | ||
<StCancelButton onClick={closeModal}>취소</StCancelButton> | ||
</StWrapper> | ||
</StAbsoluteWrapper> | ||
) : ( | ||
<></> | ||
); | ||
} | ||
|
||
export default BottomSheet; |
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,62 @@ | ||
import { ANIMATION } from '@styles/common/animation'; | ||
import { COLOR } from '@styles/common/color'; | ||
import { FONT_STYLES } from '@styles/common/font-style'; | ||
import styled from 'styled-components'; | ||
|
||
export const StAbsoluteWrapper = styled.div` | ||
position: fixed; | ||
width: 100%; | ||
height: 100vh; | ||
top: 0; | ||
`; | ||
|
||
export const StBlackBlur = styled.div<{ isClosing: boolean }>` | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100vw; | ||
height: 100vh; | ||
background-color: rgb(0, 0, 0, 0.44); | ||
z-index: 50; | ||
animation: ${({ isClosing }) => (isClosing ? ANIMATION.FADE_OUT : ANIMATION.FADE_IN)} 1s; | ||
`; | ||
|
||
export const StWrapper = styled.div<{ isClosing: boolean }>` | ||
position: fixed; | ||
width: min(100vw, 400px); | ||
border-top-left-radius: 32px; | ||
border-top-right-radius: 32px; | ||
background-color: ${COLOR.WHITE}; | ||
bottom: 0; | ||
z-index: 60; | ||
animation: ${({ isClosing }) => | ||
isClosing ? ANIMATION.SWIPE_DOWN : ANIMATION.SWIPE_UP({ from: 0 })} | ||
1s; | ||
`; | ||
|
||
export const StButton = styled.div` | ||
display: flex; | ||
align-items: center; | ||
gap: 8px; | ||
color: ${COLOR.GRAY_7}; | ||
${FONT_STYLES.R_16_BODY} | ||
`; | ||
|
||
export const StButtonWrapper = styled.div` | ||
padding-top: 30px; | ||
padding-bottom: 35px; | ||
padding-left: 18px; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 25px; | ||
`; | ||
|
||
export const StCancelButton = styled.div` | ||
text-align: center; | ||
border-top: 1px solid ${COLOR.GRAY_3}; | ||
padding-top: 16px; | ||
padding-bottom: 52px; | ||
color: ${COLOR.GRAY_6}; | ||
${FONT_STYLES.M_16_TITLE} | ||
`; |
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
Oops, something went wrong.