Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"motion": "^12.23.24",
"next": "16.0.7",
"react": "19.2.1",
"react-daum-postcode": "^3.2.0",
"react-dom": "19.2.1",
"swiper": "^12.0.3",
"tailwind-merge": "^3.3.1",
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

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
Expand Up @@ -17,7 +17,7 @@ export const MeetupDateField = ({ field }: Props) => {
const formattedDate = formatDate(new Date(field.state.value), 'YY.MM.DD - HH:mm');

const onInputClick = () => {
open(<DatePickerModal field={field} />);
open(<DatePickerModal dateField={field} />);
};

return (
Expand Down
51 changes: 31 additions & 20 deletions src/components/pages/post-meetup/fields/location-field/index.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,49 @@
'use client';

import { AnyFieldApi } from '@tanstack/react-form';
import clsx from 'clsx';

import { Icon } from '@/components/icon';
import { Input, Label } from '@/components/ui';
import { LocationSearchModal } from '@/components/pages/post-meetup/modals/location-search-modal';
import { Label } from '@/components/ui';
import { useModal } from '@/components/ui';

interface Props {
field: AnyFieldApi;
}

export const MeetupLocationField = ({ field }: Props) => {
const { open } = useModal();

const onInputClick = () => {
open(<LocationSearchModal LocationField={field} />);
};

return (
<div className='mt-3 flex w-full flex-col gap-1'>
<Label htmlFor='post-meetup-location' required>
<Label htmlFor='post-meetup-location' required onClick={onInputClick}>
모임 장소
</Label>
<Input
id='post-meetup-location'
className='bg-mono-white focus:border-mint-500 rounded-2xl border border-gray-300'
frontIcon={
<Icon
id='map-pin-1'
width={20}
className='pointer-events-none absolute top-0 left-4 flex h-full items-center text-gray-500'
height={20}
/>
}
placeholder='모임 주소를 입력해주세요'
required
type='text'
value={field.state.value}
onChange={(e) => field.handleChange(e.target.value)}
onClick={() => console.log('address clicked!')}
/>
<button
className='bg-mono-white focus:border-mint-500 relative cursor-pointer rounded-2xl border border-gray-300 p-4 pl-11 focus:outline-none'
type='button'
onClick={onInputClick}
>
<Icon
id='map-pin-1'
width={20}
className='pointer-events-none absolute top-0 left-4 flex h-full items-center text-gray-500'
height={20}
/>
<p
className={clsx(
'text-text-md-medium text-left text-gray-500',
field.state.value && 'text-gray-800',
)}
>
{field.state.value ? field.state.value : '모임 장소를 입력해주세요'}
</p>
</button>
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import { Calendar } from '@/components/pages/post-meetup/modals/date-picker-moda
import { ModalContent, ModalTitle } from '@/components/ui';

interface Props {
field: AnyFieldApi;
dateField: AnyFieldApi;
}

export const DatePickerModal = ({ field }: Props) => {
export const DatePickerModal = ({ dateField }: Props) => {
const [tabMenu, setTabMenu] = useState<'date' | 'time'>('date');

return (
Expand Down Expand Up @@ -41,8 +41,8 @@ export const DatePickerModal = ({ field }: Props) => {

<Calendar
currentTab={tabMenu}
dateFieldValue={field.state.value}
updateDateField={(selectedDate: string) => field.handleChange(selectedDate)}
dateFieldValue={dateField.state.value}
updateDateField={(selectedDate: string) => dateField.handleChange(selectedDate)}
/>

<div className='flex-center mt-5 gap-2'>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use client';

import DaumPostcodeEmbed, { Address } from 'react-daum-postcode';

import { AnyFieldApi } from '@tanstack/react-form';

import { ModalContent, ModalTitle, useModal } from '@/components/ui';

interface Props {
LocationField: AnyFieldApi;
}

export const LocationSearchModal = ({ LocationField }: Props) => {
const { close } = useModal();

const handleComplete = (data: Address) => {
const fullAddress = `${data.sido} ${data.sigungu} ${data.bname}`;
LocationField.handleChange(fullAddress);
close();
};

return (
<ModalContent className='max-w-[330px]'>
<ModalTitle>모임 장소</ModalTitle>
<section className='mt-2'>
<DaumPostcodeEmbed
minWidth={200}
style={{ height: '470px' }}
autoClose={false}
onComplete={handleComplete}
/>
</section>
</ModalContent>
);
};