style(map): refine layer and zoom controls
This commit is contained in:
@@ -46,7 +46,7 @@ function LayerVisibilitySection({ items, onToggleLayer }: LayerVisibilitySection
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="mb-1.5 px-1 text-xs font-semibold text-slate-500">业务图层</div>
|
<div className="mb-1.5 px-1 text-xs font-semibold text-slate-500">业务图层</div>
|
||||||
<div className="space-y-1.5">
|
<div className="grid grid-cols-3 gap-2">
|
||||||
{items.map((item) => {
|
{items.map((item) => {
|
||||||
const Icon = item.visible ? Eye : EyeOff;
|
const Icon = item.visible ? Eye : EyeOff;
|
||||||
const disabled = item.disabled || item.locked;
|
const disabled = item.disabled || item.locked;
|
||||||
@@ -57,33 +57,28 @@ function LayerVisibilitySection({ items, onToggleLayer }: LayerVisibilitySection
|
|||||||
type="button"
|
type="button"
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
aria-pressed={item.visible}
|
aria-pressed={item.visible}
|
||||||
|
aria-label={`${item.label}${item.description ? `,${item.description}` : ""}`}
|
||||||
|
title={item.description}
|
||||||
onClick={() => onToggleLayer(item.id, !item.visible)}
|
onClick={() => onToggleLayer(item.id, !item.visible)}
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex min-h-12 w-full items-center gap-3 border px-2.5 text-left text-sm transition duration-150",
|
"relative flex min-h-[76px] w-full flex-col items-center justify-center gap-1.5 border px-1.5 py-2 text-center transition duration-150 active:translate-y-px active:scale-[0.98]",
|
||||||
MAP_COMPACT_RADIUS_CLASS_NAME,
|
MAP_COMPACT_RADIUS_CLASS_NAME,
|
||||||
item.visible
|
item.visible
|
||||||
? "border-blue-100 bg-white/95 text-slate-900"
|
? "border-blue-200 bg-blue-50/90 text-blue-950 shadow-sm shadow-blue-950/5"
|
||||||
: "border-white/70 bg-white/95 text-slate-500 hover:border-slate-200 hover:bg-white",
|
: "border-white/70 bg-white/90 text-slate-500 hover:border-slate-200 hover:bg-white",
|
||||||
disabled && "cursor-not-allowed opacity-60 hover:bg-transparent"
|
disabled && "cursor-not-allowed opacity-60 hover:bg-transparent"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className={cn(
|
className={cn(
|
||||||
"grid h-8 w-8 shrink-0 place-items-center",
|
"grid h-8 w-8 shrink-0 place-items-center transition-colors",
|
||||||
MAP_ICON_CELL_RADIUS_CLASS_NAME,
|
MAP_ICON_CELL_RADIUS_CLASS_NAME,
|
||||||
item.visible ? "bg-blue-600 text-white" : "bg-slate-100 text-slate-400"
|
item.visible ? "bg-blue-600 text-white" : "bg-slate-100 text-slate-400"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{item.locked ? <Lock size={15} aria-hidden="true" /> : <Icon size={15} aria-hidden="true" />}
|
{item.locked ? <Lock size={15} aria-hidden="true" /> : <Icon size={15} aria-hidden="true" />}
|
||||||
</span>
|
</span>
|
||||||
<span className="min-w-0 flex-1">
|
<span className="block w-full truncate text-xs font-semibold leading-tight">{item.label}</span>
|
||||||
<span className="block truncate font-semibold">{item.label}</span>
|
|
||||||
{item.description ? <span className="block truncate text-xs text-slate-500">{item.description}</span> : null}
|
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
className={cn("h-2.5 w-2.5 rounded-full", item.visible ? "bg-blue-600" : "bg-slate-300")}
|
|
||||||
aria-hidden="true"
|
|
||||||
/>
|
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -36,13 +36,19 @@ export function MapZoom({ mapRef, mapReady, onHome, className = "" }: MapZoomPro
|
|||||||
return (
|
return (
|
||||||
<TooltipProvider delayDuration={180}>
|
<TooltipProvider delayDuration={180}>
|
||||||
<div
|
<div
|
||||||
|
role="group"
|
||||||
aria-label="地图缩放"
|
aria-label="地图缩放"
|
||||||
className={cn(
|
className={cn(
|
||||||
"pointer-events-auto flex w-[46px] flex-col p-[3px]",
|
"pointer-events-auto flex w-[46px] flex-col gap-2",
|
||||||
MAP_CONTROL_RADIUS_CLASS_NAME,
|
|
||||||
MAP_CONTROL_SURFACE_CLASS_NAME,
|
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"flex flex-col p-[3px]",
|
||||||
|
MAP_CONTROL_RADIUS_CLASS_NAME,
|
||||||
|
MAP_CONTROL_SURFACE_CLASS_NAME
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
<ControlButton
|
<ControlButton
|
||||||
icon={Plus}
|
icon={Plus}
|
||||||
@@ -57,7 +63,15 @@ export function MapZoom({ mapRef, mapReady, onHome, className = "" }: MapZoomPro
|
|||||||
disabled={!mapReady}
|
disabled={!mapReady}
|
||||||
onClick={handleZoomOut}
|
onClick={handleZoomOut}
|
||||||
/>
|
/>
|
||||||
<Divider />
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"p-[3px]",
|
||||||
|
MAP_CONTROL_RADIUS_CLASS_NAME,
|
||||||
|
MAP_CONTROL_SURFACE_CLASS_NAME
|
||||||
|
)}
|
||||||
|
>
|
||||||
<ControlButton
|
<ControlButton
|
||||||
icon={Home}
|
icon={Home}
|
||||||
label="缩放到全局"
|
label="缩放到全局"
|
||||||
@@ -65,6 +79,7 @@ export function MapZoom({ mapRef, mapReady, onHome, className = "" }: MapZoomPro
|
|||||||
onClick={onHome}
|
onClick={onHome}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user