feat: add next step button
This commit is contained in:
parent
b56ea5ee98
commit
9b8b3ff401
|
|
@ -0,0 +1,41 @@
|
||||||
|
import { css } from "@emotion/react";
|
||||||
|
import { ButtonHTMLAttributes, DetailedHTMLProps } from "react";
|
||||||
|
|
||||||
|
type ButtonProps = DetailedHTMLProps<
|
||||||
|
ButtonHTMLAttributes<HTMLButtonElement>,
|
||||||
|
HTMLButtonElement
|
||||||
|
>;
|
||||||
|
|
||||||
|
export function BottomButton(props: ButtonProps) {
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
css={css({
|
||||||
|
position: "absolute",
|
||||||
|
zIndex: 9999,
|
||||||
|
right: "2rem",
|
||||||
|
bottom: "2rem",
|
||||||
|
color: "#000000",
|
||||||
|
backgroundColor: "#ffffff96",
|
||||||
|
backdropFilter: "blur(8px)",
|
||||||
|
border: "none",
|
||||||
|
padding: "0.75rem 1.25rem",
|
||||||
|
borderRadius: "8px",
|
||||||
|
fontWeight: "300",
|
||||||
|
fontSize: "14px",
|
||||||
|
outline: "rgba(240, 240, 244, 0.51) solid 0.1rem",
|
||||||
|
cursor: "pointer",
|
||||||
|
transition: "0.2s",
|
||||||
|
":hover": {
|
||||||
|
backgroundColor: "#ebeef0c2",
|
||||||
|
},
|
||||||
|
":disabled": {
|
||||||
|
backgroundColor: "#ebeef0c2",
|
||||||
|
cursor: "not-allowed",
|
||||||
|
},
|
||||||
|
})}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{props.children}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
export function ProcessingMap() {
|
||||||
|
return <p>processing</p>;
|
||||||
|
}
|
||||||
|
|
@ -9,7 +9,13 @@ import L, { LatLng, LatLngBounds } from "leaflet";
|
||||||
import "leaflet/dist/leaflet.css";
|
import "leaflet/dist/leaflet.css";
|
||||||
import { css } from "@emotion/react";
|
import { css } from "@emotion/react";
|
||||||
|
|
||||||
function RectangleSelector({ isDrag = true }: { isDrag: boolean }) {
|
function RectangleSelector({
|
||||||
|
isDrag = true,
|
||||||
|
onChange,
|
||||||
|
}: {
|
||||||
|
isDrag: boolean;
|
||||||
|
onChange: (LatLngBounds: LatLngBounds) => void;
|
||||||
|
}) {
|
||||||
const [bounds, setBounds] = useState<LatLngBounds | null>(null);
|
const [bounds, setBounds] = useState<LatLngBounds | null>(null);
|
||||||
const [firstPoint, setFirstPoint] = useState<LatLng | null>(null);
|
const [firstPoint, setFirstPoint] = useState<LatLng | null>(null);
|
||||||
|
|
||||||
|
|
@ -35,7 +41,7 @@ function RectangleSelector({ isDrag = true }: { isDrag: boolean }) {
|
||||||
mouseup(e) {
|
mouseup(e) {
|
||||||
if (firstPoint) {
|
if (firstPoint) {
|
||||||
setBounds(new L.LatLngBounds(firstPoint, e.latlng));
|
setBounds(new L.LatLngBounds(firstPoint, e.latlng));
|
||||||
console.log(firstPoint, e.latlng);
|
onChange(new L.LatLngBounds(firstPoint, e.latlng));
|
||||||
setFirstPoint(null);
|
setFirstPoint(null);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -45,11 +51,17 @@ function RectangleSelector({ isDrag = true }: { isDrag: boolean }) {
|
||||||
) : null;
|
) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MapComponent() {
|
export function MapComponent({ onDone }: { onDone: (e) => void }) {
|
||||||
const [isDrag, setIsDrag] = useState(true);
|
const [isDrag, setIsDrag] = useState(true);
|
||||||
|
|
||||||
const handleClickSwitchDrag = () => {
|
const handleClickSwitchDrag = () => {
|
||||||
setIsDrag(!isDrag);
|
setIsDrag(!isDrag);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleChangeDone = (e) => {
|
||||||
|
onDone([e._northEast, e._southWest]);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
css={css({
|
css={css({
|
||||||
|
|
@ -89,7 +101,7 @@ export function MapComponent() {
|
||||||
attribution='© <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors'
|
attribution='© <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors'
|
||||||
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||||
/>
|
/>
|
||||||
<RectangleSelector isDrag={isDrag} />
|
<RectangleSelector isDrag={isDrag} onChange={handleChangeDone} />
|
||||||
</MapContainer>
|
</MapContainer>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,18 @@ import { Title } from "@/components/text/Title";
|
||||||
import { Description } from "@/components/text/Description";
|
import { Description } from "@/components/text/Description";
|
||||||
import { Column } from "@/components/flex/Column";
|
import { Column } from "@/components/flex/Column";
|
||||||
import { MapComponent } from "@/components/map/SelectMap";
|
import { MapComponent } from "@/components/map/SelectMap";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { BottomButton } from "@/components/button/BottomButton";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
const [isNextButtonDisabled, setIsNextButtonDisabled] = useState(true);
|
||||||
|
const handleDone = (e) => {
|
||||||
|
console.log(e);
|
||||||
|
setIsNextButtonDisabled(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClickNextStep = () => {};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div css={css({ height: "100%", width: "100%" })}>
|
<div css={css({ height: "100%", width: "100%" })}>
|
||||||
<FullscreenModal isOpen={true}>
|
<FullscreenModal isOpen={true}>
|
||||||
|
|
@ -17,9 +27,17 @@ function App() {
|
||||||
Tools to create 3D maps based on maps and export them in 3D format
|
Tools to create 3D maps based on maps and export them in 3D format
|
||||||
</Description>
|
</Description>
|
||||||
</Column>
|
</Column>
|
||||||
<MapComponent></MapComponent>
|
<MapComponent onDone={handleDone}></MapComponent>
|
||||||
</Column>
|
</Column>
|
||||||
</FullscreenModal>
|
</FullscreenModal>
|
||||||
|
|
||||||
|
<BottomButton
|
||||||
|
disabled={isNextButtonDisabled}
|
||||||
|
onClick={handleClickNextStep}
|
||||||
|
>
|
||||||
|
Next Step
|
||||||
|
</BottomButton>
|
||||||
|
|
||||||
<Space />
|
<Space />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue