-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[가게 등록] 가게 등록 페이지 PC 버전 로직 구현 및 API 구현
- Loading branch information
Showing
63 changed files
with
1,206 additions
and
524 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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { accessClient } from 'api'; | ||
import { StoreCategory } from 'model/category/storeCategory'; | ||
|
||
const getStoreCategory = async () => { | ||
const getShopCategory = async () => { | ||
const { data } = await accessClient.get<StoreCategory>('/shops/categories'); | ||
return StoreCategory.parse(data); | ||
}; | ||
|
||
export default getStoreCategory; | ||
export default getShopCategory; |
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
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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,28 @@ | ||
import z from 'zod'; | ||
|
||
const Open = z.object({ | ||
day_of_week: z.string(), | ||
closed: z.boolean(), | ||
open_time: z.string().nullable(), | ||
close_time: z.string().nullable(), | ||
}); | ||
|
||
export const Shop = z.object({ | ||
id: z.number(), | ||
name: z.string(), | ||
phone: z.string(), | ||
delivery: z.boolean(), | ||
pay_bank: z.boolean(), | ||
pay_card: z.boolean(), | ||
open: z.array(Open), | ||
category_ids: z.array(z.number()), | ||
}); | ||
|
||
export type Shop = z.infer<typeof Shop>; | ||
|
||
export const ShopListRes = z.object({ | ||
count: z.number(), | ||
shops: z.array(Shop), | ||
}); | ||
|
||
export type ShopListRes = z.infer<typeof ShopListRes>; |
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,11 @@ | ||
import z from 'zod'; | ||
import { Shop } from './allShopInfo'; | ||
|
||
export const OwnerShop = Shop.omit({ id: true }).extend({ | ||
address: z.string(), | ||
description: z.string(), | ||
delivery_price: z.string(), | ||
image_urls: z.array(z.string()), | ||
}); | ||
|
||
export type OwnerShop = z.infer<typeof OwnerShop>; |
File renamed without changes.
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
File renamed without changes.
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,44 @@ | ||
import type { UseFormRegister } from 'react-hook-form'; | ||
import { OwnerShop } from 'model/shopInfo/ownerShop'; | ||
import { HTMLInputTypeAttribute, useState } from 'react'; | ||
import styles from './InputBox.module.scss'; | ||
|
||
interface InputBoxProps { | ||
content: string; | ||
id: keyof OwnerShop | ||
register: UseFormRegister<OwnerShop>; | ||
inputType: HTMLInputTypeAttribute; | ||
} | ||
|
||
function formatPhoneNumber(inputNumber: string) { | ||
const phoneNumber = inputNumber.replace(/\D/g, ''); | ||
|
||
const formattedPhoneNumber = phoneNumber.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3'); | ||
|
||
return formattedPhoneNumber; | ||
} | ||
|
||
export default function InputBox({ | ||
content, id, register, inputType, | ||
}: InputBoxProps) { | ||
const [formattedPhoneNumber, setFormattedPhoneNumber] = useState(''); | ||
|
||
const handlePhoneChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
const inputNumber = e.target.value; | ||
const formattedNumber = formatPhoneNumber(inputNumber); | ||
setFormattedPhoneNumber(formattedNumber); | ||
}; | ||
return ( | ||
<label htmlFor={id} className={styles.form}> | ||
<span className={styles.form__label}>{content}</span> | ||
<input | ||
type={inputType} | ||
id={id} | ||
className={styles.form__input} | ||
{...register(id)} | ||
onChange={inputType === 'tel' ? handlePhoneChange : undefined} | ||
value={inputType === 'tel' ? formattedPhoneNumber : undefined} | ||
/> | ||
</label> | ||
); | ||
} |
File renamed without changes.
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
Oops, something went wrong.