-
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.
Merge pull request #55 from themoment-team/develop
Release �v1.2.0
- Loading branch information
Showing
32 changed files
with
372 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const ImageRegisterIcon = () => ( | ||
<svg | ||
xmlns='http://www.w3.org/2000/svg' | ||
width='3rem' | ||
height='3rem' | ||
viewBox='0 0 48 48' | ||
fill='none' | ||
> | ||
<path | ||
fillRule='evenodd' | ||
clipRule='evenodd' | ||
d='M37 8H11C9.34315 8 8 9.34315 8 11V37C8 38.6569 9.34315 40 11 40H37C38.6569 40 40 38.6569 40 37V11C40 9.34315 38.6569 8 37 8ZM11 6C8.23858 6 6 8.23858 6 11V37C6 39.7614 8.23858 42 11 42H37C39.7614 42 42 39.7614 42 37V11C42 8.23858 39.7614 6 37 6H11ZM13.2 33.4C12.7056 34.0592 13.176 35 14 35H21.9638H22H34.0362C34.8535 35 35.3257 34.0728 34.845 33.4118L28.8087 25.112C28.4094 24.5629 27.5906 24.5629 27.1913 25.112L21.9692 32.2923L18.8 28.0667C18.4 27.5333 17.6 27.5333 17.2 28.0667L13.2 33.4Z' | ||
fill='#CBCCCE' | ||
/> | ||
</svg> | ||
); | ||
|
||
export default ImageRegisterIcon; |
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
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
13 changes: 13 additions & 0 deletions
13
src/components/Modal/MyPage/ModalWrapper/index.stories.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,13 @@ | ||
import ModalWrapper from '.'; | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
const meta: Meta<typeof ModalWrapper> = { | ||
component: ModalWrapper, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof ModalWrapper>; | ||
|
||
export const Primary: Story = {}; |
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,29 @@ | ||
/**@jsxImportSource @emotion/react */ | ||
|
||
'use client'; | ||
|
||
import React from 'react'; | ||
|
||
import type { Interpolation, Theme } from '@emotion/react'; | ||
|
||
import * as S from './style'; | ||
|
||
interface Props { | ||
children: React.ReactNode; | ||
closeModal: () => void; | ||
innerCss?: Interpolation<Theme>; | ||
} | ||
|
||
const MyPageModalWrapper: React.FC<Props> = ({ | ||
children, | ||
closeModal, | ||
innerCss, | ||
}) => ( | ||
<S.ModalWrapper onClick={closeModal}> | ||
<S.ModalInner onClick={(e) => e.stopPropagation()} css={innerCss}> | ||
{children} | ||
</S.ModalInner> | ||
</S.ModalWrapper> | ||
); | ||
|
||
export default MyPageModalWrapper; |
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,21 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
export const ModalWrapper = styled.div` | ||
width: 100vw; | ||
height: 100vh; | ||
height: 100dvh; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
background-color: rgba(0, 0, 0, 0.15); | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
z-index: 10; | ||
`; | ||
|
||
export const ModalInner = styled.div` | ||
padding: 1rem 1.75rem; | ||
border-radius: 0.625rem; | ||
background: ${({ theme }) => theme.color.white}; | ||
`; |
13 changes: 13 additions & 0 deletions
13
src/components/Modal/MyPage/ProfileImgRegister/index.stories.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,13 @@ | ||
import ProfileImgRegister from '.'; | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
const meta: Meta<typeof ProfileImgRegister> = { | ||
component: ProfileImgRegister, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof ProfileImgRegister>; | ||
|
||
export const Primary: Story = {}; |
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,82 @@ | ||
'use client'; | ||
|
||
import { css } from '@emotion/react'; | ||
|
||
import { toast } from 'react-toastify'; | ||
|
||
import * as S from './style'; | ||
|
||
import { ImageRegisterIcon } from '@/assets'; | ||
import { MyPageModalWrapper } from '@/components'; | ||
import { useGetMyInfo, usePostProfileImgUrl } from '@/hooks'; | ||
import { usePostUploadFile } from '@/hooks'; | ||
import type { PostProfileImgType } from '@/types'; | ||
|
||
interface Props { | ||
closeModal: () => void; | ||
} | ||
|
||
const ProfileImgRegisterModal: React.FC<Props> = ({ closeModal }) => { | ||
const { mutate: mutateUploadFile } = usePostUploadFile(); | ||
const { mutate: mutateProfileImgUrl } = usePostProfileImgUrl(); | ||
const { refetch: refetchGetMyInfo } = useGetMyInfo(); | ||
|
||
const handleFileInputChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
if (!e.target.files) return; | ||
|
||
const profileImg = e.target.files[0]; | ||
|
||
if (profileImg.size > 1024 * 1024 * 20) { | ||
return toast.error('프로필 이미지는 20MB 이하만 업로드 가능합니다.'); | ||
} | ||
|
||
const formData = new FormData(); | ||
|
||
formData.append('file', profileImg); | ||
|
||
mutateUploadFile(formData, { | ||
onSuccess: ({ fileUrl }) => { | ||
const data: PostProfileImgType = { | ||
profileUrl: fileUrl, | ||
}; | ||
|
||
mutateProfileImgUrl(data, { | ||
onSuccess: () => { | ||
toast.success('프로필 이미지 업로드에 성공했습니다.'); | ||
refetchGetMyInfo(); | ||
closeModal(); | ||
}, | ||
onError: () => { | ||
toast.error('프로필 이미지 업로드에 실패했습니다.'); | ||
}, | ||
}); | ||
}, | ||
onError: () => { | ||
toast.error('프로필 이미지 업로드에 실패했습니다.'); | ||
}, | ||
}); | ||
}; | ||
|
||
return ( | ||
<MyPageModalWrapper | ||
closeModal={closeModal} | ||
innerCss={css` | ||
border-radius: 1.25rem; | ||
padding: 1.5rem; | ||
`} | ||
> | ||
<S.Title>프로필 이미지 변경</S.Title> | ||
<S.ImgInput | ||
type='file' | ||
id='img-input' | ||
accept='image/*' | ||
onChange={handleFileInputChange} | ||
/> | ||
<S.ImgInputLabel htmlFor='img-input'> | ||
<ImageRegisterIcon /> | ||
</S.ImgInputLabel> | ||
</MyPageModalWrapper> | ||
); | ||
}; | ||
|
||
export default ProfileImgRegisterModal; |
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,23 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
export const Title = styled.p` | ||
${({ theme }) => theme.typo.body1}; | ||
color: ${({ theme }) => theme.color.grey[800]}; | ||
margin-bottom: 1.5rem; | ||
`; | ||
|
||
export const ImgInput = styled.input` | ||
display: none; | ||
`; | ||
|
||
export const ImgInputLabel = styled.label` | ||
width: 14.5rem; | ||
height: 14rem; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background: ${({ theme }) => theme.color.grey[50]}; | ||
border: 1px dashed ${({ theme }) => theme.color.grey[200]}; | ||
border-radius: 0.625rem; | ||
cursor: pointer; | ||
`; |
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,2 @@ | ||
export { default as MyPageModalWrapper } from './ModalWrapper'; | ||
export { default as ProfileImgRegisterModal } from './ProfileImgRegister'; |
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 +1,2 @@ | ||
export * from './MyPage'; | ||
export { default as FilterModal } from './Filter'; |
Oops, something went wrong.