"디지털하수관로" UI 수정
This commit is contained in:
@@ -1,30 +1,67 @@
|
||||
import React, { useContext, useState } from 'react';
|
||||
import { GisContext } from './Gis';
|
||||
import React, { useContext, useState } from "react";
|
||||
import { GisContext } from "./Gis";
|
||||
|
||||
export default React.memo(function MapToggleBtn() {
|
||||
const { gisCore } = useContext(GisContext);
|
||||
const [activeMap, setActiveMap] = useState({ label: '일반', type: 'base' }); // 기본 선택값
|
||||
export default React.memo(function MapToggleBtn({ alwaysVisibleTabs = false }) {
|
||||
const { gisCore } = useContext(GisContext);
|
||||
const [activeMap, setActiveMap] = useState({ label: "일반", type: "base" }); // 기본 선택값
|
||||
|
||||
const handleSelect = mapObj => {
|
||||
setActiveMap(mapObj);
|
||||
gisCore.changeBaseLayer(mapObj.type);
|
||||
};
|
||||
const handleSelect = (mapObj) => {
|
||||
setActiveMap(mapObj);
|
||||
gisCore.changeBaseLayer(mapObj.type);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mapbtn">
|
||||
<button className="sprite_gis viewer" title="지도선택">지도 선택</button>
|
||||
<ul className="choice_map">
|
||||
<li className={activeMap.type === 'base' ? 'on' : ''}>
|
||||
<button className="map1" id="base" title="일반지도" onClick={() => handleSelect({ label: '일반', type: 'base' })}>
|
||||
<div>일반지도</div>
|
||||
</button>
|
||||
</li>
|
||||
<li className={activeMap.type === 'satellite' ? 'on' : ''}>
|
||||
<button className="map2" id="satelite" title="위성지도" onClick={() => handleSelect({ label: '위성', type: 'satellite' })}>
|
||||
<div>위성지도</div>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
if (alwaysVisibleTabs) {
|
||||
return (
|
||||
<div className="mapbtn mapbtn-tabs">
|
||||
<div className="map-type-tabs" role="group" aria-label="지도 유형 선택">
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed={activeMap.type === "base"}
|
||||
className={activeMap.type === "base" ? "on" : ""}
|
||||
onClick={() => handleSelect({ label: "일반", type: "base" })}
|
||||
>
|
||||
일반지도
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed={activeMap.type === "satellite"}
|
||||
className={activeMap.type === "satellite" ? "on" : ""}
|
||||
onClick={() => handleSelect({ label: "위성", type: "satellite" })}
|
||||
>
|
||||
위성지도
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mapbtn">
|
||||
<button className="sprite_gis viewer" title="지도선택">
|
||||
지도 선택
|
||||
</button>
|
||||
<ul className="choice_map">
|
||||
<li className={activeMap.type === "base" ? "on" : ""}>
|
||||
<button
|
||||
className="map1"
|
||||
id="base"
|
||||
title="일반지도"
|
||||
onClick={() => handleSelect({ label: "일반", type: "base" })}
|
||||
>
|
||||
<div>일반지도</div>
|
||||
</button>
|
||||
</li>
|
||||
<li className={activeMap.type === "satellite" ? "on" : ""}>
|
||||
<button
|
||||
className="map2"
|
||||
id="satelite"
|
||||
title="위성지도"
|
||||
onClick={() => handleSelect({ label: "위성", type: "satellite" })}
|
||||
>
|
||||
<div>위성지도</div>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user