Skip to content

Commit

Permalink
Merge pull request #278 from gloddy-dev/feature/274-refactoring-creat…
Browse files Browse the repository at this point in the history
…e-group-page

Feature : 모임 개설 페이지 및 BottomSheet 리팩토링
  • Loading branch information
kangju2000 authored Aug 29, 2023
2 parents 7090d03 + 2908f64 commit aaa686c
Show file tree
Hide file tree
Showing 25 changed files with 379 additions and 348 deletions.
10 changes: 10 additions & 0 deletions public/icons/48/add_photo_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 13 additions & 5 deletions src/apis/groups/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export interface Grouping {
meetDate: string; // '2021-08-01'
startTime: string; // '19:00'
endTime: string; // '21:00'
placeName: string;
placeAddress: string;
placeLatitude: number;
placeLongitude: number;
}
Expand All @@ -23,10 +25,6 @@ export interface Article {
commentCount: number;
isCertifiedStudent: boolean;
isCaptain: boolean;
isWriter: boolean;
isWriterCaptain: boolean;
isWriterCertifiedStudent: boolean;
writerReliabilityLevel: string;
images: string[];
}

Expand All @@ -52,8 +50,18 @@ export interface GroupDetailResponse extends Omit<Grouping, 'groupId'> {
isCaptain: true;
}

export interface CreateGroupRequest extends Omit<Grouping, 'groupId' | 'memberCount' | 'imageUrl'> {
export interface CreateGroupRequest {
imageUrl: string;
title: string;
content: string;
meetDate: string;
startTime: string;
endTime: string;
placeName: string;
placeAddress: string;
placeLatitude: string;
placeLongitude: string;
maxUser: number;
}

export interface ArticleRequest {
Expand Down
38 changes: 19 additions & 19 deletions src/app/(main)/grouping/create/components/CreateGroupContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@ import { UseFormReturn, useForm } from 'react-hook-form';

import type { StrictPropsWithChildren } from '@/types';

const inputDefaultValues: CreateGroupContextValue = {
imageUrl: '',
title: '',
content: '',
date: new Date(),
time: {
fromHour: '1',
fromMin: '0',
fromAmPm: 'AM',
toHour: '1',
toMin: '0',
toAmPm: 'AM',
},
place: '',
placeLatitude: 0,
placeLongitude: 0,
maxUser: 0,
};
const CreateGroupContext = createContext<UseFormReturn | null>(null);

export default function CreateGroupContextProvider({ children }: StrictPropsWithChildren) {
const methods = useForm<CreateGroupContextValue>({
defaultValues: inputDefaultValues,
defaultValues: {
imageFile: undefined,
title: '',
content: '',
meetDate: undefined,
time: {
fromHour: '1',
fromMin: '0',
fromAmPm: 'AM',
toHour: '1',
toMin: '0',
toAmPm: 'AM',
},
placeName: '',
placeAddress: '',
placeLatitude: undefined,
placeLongitude: undefined,
maxUser: undefined,
},
});

const contextValue = { ...methods };
Expand Down
29 changes: 12 additions & 17 deletions src/app/(main)/grouping/create/components/CreateHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
'use client';
import { IconButton } from '@/components/Button';
import { Header } from '@/components/Header';
import Image from 'next/image';
import { useRouter } from 'next/navigation';
import Link from 'next/link';

export default function CreateHeader() {
const router = useRouter();
return (
<Header
leftNode={
<Image
alt="back"
src="/assets/arrow_back.svg"
width={8}
height={30}
onClick={() => {
router.back();
}}
/>
}
text="모임 개설하기"
/>
<Header className="px-4">
<Header.Left>
<Link href="/grouping">
<IconButton size="large">
<Image src="/icons/24/arrow_back.svg" alt="back" width={24} height={24} />
</IconButton>
</Link>
<p>모임 개설하기</p>
</Header.Left>
</Header>
);
}
20 changes: 20 additions & 0 deletions src/app/(main)/grouping/create/components/CreateModal.client.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Spacing } from '@/components/common/Spacing';
import { Modal } from '@/components/Modal';
import Image from 'next/image';

interface CreateModalProps {
onOkClick: () => void;
onCancelClick: () => void;
}

export default function CreateModal({ onOkClick, onCancelClick }: CreateModalProps) {
return (
<Modal variant="warning" onOkClick={onOkClick} onCancelClick={onCancelClick}>
<Spacing size={32} />
<Image src="/icons/48/warning.svg" width={48} height={48} alt="warning" />
<Spacing size={12} />
<p>계속하시겠어요?</p>
<Spacing size={16} />
</Modal>
);
}
23 changes: 0 additions & 23 deletions src/app/(main)/grouping/create/components/GroupingModal.client.tsx

This file was deleted.

Loading

0 comments on commit aaa686c

Please sign in to comment.