Skip to content

Commit

Permalink
feat: 신고 버튼 개발
Browse files Browse the repository at this point in the history
  • Loading branch information
shinwonse committed Oct 8, 2023
1 parent ba618f2 commit 7e4e44e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
12 changes: 12 additions & 0 deletions src/pages/records/[id]/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
padding: 20px 30px calc(env(safe-area-inset-bottom) + 50px);
}

.above-title {
display: flex;
flex-direction: row;
align-content: center;
justify-content: space-between;
}

.report-button {
color: themes.$grey300;
@include themes.typography('caption12');
}

.title-area {
display: flex;
flex-wrap: wrap;
Expand Down
34 changes: 28 additions & 6 deletions src/pages/records/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Chip from '@/shared/components/Chip';
import Icon from '@/shared/components/Icon';
import PageLayout from '@/shared/components/PageLayout';
import TopNavigator from '@/shared/components/TopNavigator';
import useConfirm from '@/shared/hooks/useConfirm';
import { Alcohol } from '@/shared/types/alcohol';
import { Record } from '@/shared/types/record';
import { FlavorTag } from '@/shared/types/record/flavorTag';
Expand All @@ -28,6 +29,7 @@ type RecordDetailProps = {

const RecordDetail = ({ id }: RecordDetailProps) => {
const { data } = useGetRecord({ variables: { recordId: id } });
const { confirm } = useConfirm();

const formatRecordTags = useCallback(
([alcoholPercent, alcoholPercentFeeling, flavorDetailTag]: [
Expand All @@ -46,6 +48,17 @@ const RecordDetail = ({ id }: RecordDetailProps) => {
[]
);

const handleClickReport = async () => {
if (
await confirm({
message: '정말 신고하시겠어요?',
okText: '확인',
})
) {
window.location.href = 'mailto:[email protected]';
}
};

if (!data) {
return null;
}
Expand All @@ -57,12 +70,21 @@ const RecordDetail = ({ id }: RecordDetailProps) => {
<TopNavigator title="내 게시글" />
<ImageSwiper images={record.photoPathList.map((url) => ({ url }))} />
<div className={cx('contents-wrap')}>
<Chip
label="과실주"
type="Primary"
appearance="round"
size="mediumLarge"
/>
<div className={cx('above-title')}>
<Chip
label="과실주"
type="Primary"
appearance="round"
size="mediumLarge"
/>
<button
onClick={handleClickReport}
className={cx('report-button')}
type="button"
>
신고하기
</button>
</div>
<div className={cx('title-area')}>
<h1 className={cx('title')}>{alcoholInfo.alcoholName}</h1>
<span className={cx('location')}>
Expand Down

0 comments on commit 7e4e44e

Please sign in to comment.