-
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.
- Loading branch information
1 parent
1329f89
commit 844338c
Showing
16 changed files
with
56,219 additions
and
146 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import data from "./sgg.json" | ||
|
||
export function GET(request: Request) { | ||
const { searchParams } = new URL(request.url) | ||
const id = searchParams.get("id") ?? "" | ||
|
||
const geoData = data as { [key: string]: any } | ||
return Response.json(geoData[id]) | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,31 +1,40 @@ | ||
import { TextInput } from "@reactleaf/input/hookform" | ||
import { BasicModalProps } from "@reactleaf/modal" | ||
import { useRouter } from "next/navigation" | ||
import { toast } from "react-toastify" | ||
import { FormProvider, useForm } from "react-hook-form" | ||
|
||
import RightSheet from "@/modals/_template/RightSheet" | ||
import RightSheet from "../_template/RightSheet" | ||
|
||
import * as S from "./RegionCreate.style" | ||
|
||
interface Props extends BasicModalProps {} | ||
export default function RegionCreate({ visible, close }: Props) { | ||
const router = useRouter() | ||
interface Props extends BasicModalProps { | ||
defaultName?: string | ||
onConfirm?: (name: string) => void | ||
onCancel?: () => void | ||
} | ||
export default function RegionCreate({ defaultName, onConfirm, onCancel, visible, close }: Props) { | ||
const form = useForm<{ name: string }>({ defaultValues: { name: defaultName } }) | ||
|
||
function openRegionSelector() { | ||
return toast.error("준비중인 기능입니다.") | ||
function onSubmit(value: { name: string }) { | ||
onConfirm?.(value.name) | ||
close() | ||
} | ||
|
||
const goToDraw = (type: "circle" | "polygon") => () => { | ||
router.push(`/region/draw?type=${type}`) | ||
function handleCancel() { | ||
onCancel?.() | ||
close() | ||
} | ||
|
||
return ( | ||
<RightSheet title="오픈 지역 추가" visible={visible} close={close}> | ||
<S.ButtonsWrapper> | ||
<S.Button onClick={openRegionSelector}>행정구역 단위로 추가</S.Button> | ||
<S.Button onClick={goToDraw("circle")}>원형 그리기</S.Button> | ||
<S.Button onClick={goToDraw("polygon")}>폴리곤 그리기</S.Button> | ||
</S.ButtonsWrapper> | ||
<form style={{ width: 260, padding: "0 20px" }} onSubmit={form.handleSubmit(onSubmit)}> | ||
<FormProvider {...form}> | ||
<TextInput label="지역명" name="name" /> | ||
</FormProvider> | ||
<div> | ||
<button onClick={handleCancel} type="button"> | ||
취소 | ||
</button> | ||
<button>추가하기</button> | ||
</div> | ||
</form> | ||
</RightSheet> | ||
) | ||
} |
9 changes: 9 additions & 0 deletions
9
...modals/RegionCreate/RegionCreate.style.ts → app/modals/RegionDraw/RegionDraw.style.ts
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.