-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FE] QR코드로 초대하기 기능 추가 #783
Changes from 4 commits
f992519
ebcc114
fe34b2e
e402fb5
187a502
0b6baa4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import {useNavigate} from 'react-router-dom'; | ||
|
||
import toast from '@hooks/useToast/toast'; | ||
|
||
import {Button} from '@components/Design'; | ||
import {Dropdown, DropdownButton} from '@components/Design'; | ||
|
||
import getEventIdByUrl from '@utils/getEventIdByUrl'; | ||
|
||
type DesktopShareEventButtonProps = React.PropsWithChildren<React.HTMLAttributes<HTMLButtonElement>> & { | ||
onCopy: () => Promise<void>; | ||
}; | ||
|
||
const DesktopShareEventButton = ({onCopy, children, ...buttonProps}: DesktopShareEventButtonProps) => { | ||
const DesktopShareEventButton = ({onCopy}: DesktopShareEventButtonProps) => { | ||
const copyAndToast = async () => { | ||
await onCopy(); | ||
toast.confirm('링크가 복사되었어요 :) \n참여자들에게 링크를 공유해 주세요!', { | ||
|
@@ -15,10 +19,20 @@ const DesktopShareEventButton = ({onCopy, children, ...buttonProps}: DesktopShar | |
}); | ||
}; | ||
|
||
const navigate = useNavigate(); | ||
const eventId = getEventIdByUrl(); | ||
|
||
const navigateQRPage = () => { | ||
navigate(`/event/${eventId}/qrcode`); | ||
}; | ||
|
||
return ( | ||
<Button size="small" variants="tertiary" onClick={copyAndToast} style={{marginRight: '1rem'}} {...buttonProps}> | ||
{children} | ||
</Button> | ||
<div style={{marginRight: '1rem'}}> | ||
<Dropdown base="button" baseButtonText="정산 초대하기"> | ||
<DropdownButton text="링크 복사하기" onClick={copyAndToast} /> | ||
<DropdownButton text="QR코드로 초대하기" onClick={navigateQRPage} /> | ||
</Dropdown> | ||
</div> | ||
); | ||
Comment on lines
+30
to
36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 빠르게 드랍다운까지 넣어주셔서 감사합니다~~ |
||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import {useNavigate} from 'react-router-dom'; | ||
|
||
import toast from '@hooks/useToast/toast'; | ||
|
||
import {Dropdown, DropdownButton} from '@components/Design'; | ||
|
||
import getEventIdByUrl from '@utils/getEventIdByUrl'; | ||
|
||
type MobileShareEventButtonProps = { | ||
copyShare: () => Promise<void>; | ||
kakaoShare: () => void; | ||
|
@@ -16,10 +20,18 @@ const MobileShareEventButton = ({copyShare, kakaoShare}: MobileShareEventButtonP | |
}); | ||
}; | ||
|
||
const navigate = useNavigate(); | ||
const eventId = getEventIdByUrl(); | ||
|
||
const navigateQRPage = () => { | ||
navigate(`/event/${eventId}/qrcode`); | ||
}; | ||
|
||
return ( | ||
<div style={{marginRight: '1rem'}}> | ||
<Dropdown base="button" baseButtonText="정산 초대하기"> | ||
<DropdownButton text="링크 복사하기" onClick={copyAndToast} /> | ||
<DropdownButton text="QR코드로 초대하기" onClick={navigateQRPage} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 나중에 여유있을 때 amplitude에 qr코드를 얼마나 사용자들이 클릭하는지 알아봐도 좋을 것 같아요 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 좋네요.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 엠플리튜드 최고 |
||
<DropdownButton text="카카오톡으로 초대하기" onClick={kakaoShare} /> | ||
</Dropdown> | ||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import {css} from '@emotion/react'; | ||
|
||
export const QRCodeStyle = () => css` | ||
position: relative; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {css} from '@emotion/react'; | ||
import {QRCodeSVG} from 'qrcode.react'; | ||
|
||
import {MainLayout, Top, TopNav} from '@components/Design'; | ||
import {useTheme} from '@components/Design'; | ||
|
||
import getEventPageUrlByEnvironment from '@utils/getEventPageUrlByEnvironment'; | ||
import getEventIdByUrl from '@utils/getEventIdByUrl'; | ||
|
||
import {QRCodeStyle} from './QRCodePage.style'; | ||
|
||
const QRCodePage = () => { | ||
const {theme} = useTheme(); | ||
const eventId = getEventIdByUrl(); | ||
|
||
return ( | ||
<MainLayout backgroundColor="white"> | ||
<TopNav> | ||
<TopNav.Item displayName="뒤로가기" noEmphasis routePath="-1" /> | ||
</TopNav> | ||
<div | ||
css={css` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
padding: 1rem; | ||
`} | ||
> | ||
Comment on lines
+21
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 부분 FunnelLayout을 사용해도 적용이 됩니다 :) (뭔가 만들어놓고 홍보를 못 해서 아쉽긴하지만..) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오홍! 그런게 있었는지 몰랐네요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 그리고 style 분리해도 좋을 것 같아요~!~! |
||
<Top> | ||
<Top.Line text="QR코드를 공유하여" emphasize={['QR코드']} /> | ||
<Top.Line text="참여자를 초대해 보세요" /> | ||
</Top> | ||
</div> | ||
<div css={QRCodeStyle()}> | ||
<QRCodeSVG value={getEventPageUrlByEnvironment(eventId, 'home')} size={240} fgColor={`${theme.colors.black}`} /> | ||
</div> | ||
</MainLayout> | ||
); | ||
}; | ||
|
||
export default QRCodePage; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ const EditBillPage = lazy(() => import('@pages/EditBillPage/EditBillPage')); | |
const Account = lazy(() => import('@pages/AccountPage/Account')); | ||
const ImagesPage = lazy(() => import('@pages/ImagesPage/ImagesPage')); | ||
const AddImagesPage = lazy(() => import('@pages/AddImagesPage/AddImagesPage')); | ||
const QRCodePage = lazy(() => import('@pages/QRCodePage/QRCodePage')); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lazy loading까지 꼼꼼하게.. 너무 좋아요 |
||
|
||
const router = createBrowserRouter([ | ||
{ | ||
|
@@ -92,6 +93,10 @@ const router = createBrowserRouter([ | |
element: <SendPage />, | ||
errorElement: <SendErrorPage />, | ||
}, | ||
{ | ||
path: ROUTER_URLS.qrCode, | ||
element: <QRCodePage />, | ||
}, | ||
{ | ||
path: '*', | ||
element: <ErrorPage />, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
z-index 대신 수정해줘서 고마워요~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
소하의 zindex 창고 🚀🚀🚀