Skip to content

Commit 8ecac92

Browse files
refactor: loading location button
1 parent 4a79a8a commit 8ecac92

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

frontend/src/components/Map.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,10 @@ function getIconByPaymentMethods(tags: Record<string, string>) {
530530
function LocationButton() {
531531
const map = useMap();
532532
const [loading, setLoading] = useState(false);
533+
// Adicionar useEffect para chamar addCustomStyles (Adicionar estilos personalizados)
534+
useEffect(() => {
535+
addCustomStyles();
536+
}, []);
533537

534538
const handleGetLocation = () => {
535539
setLoading(true);
@@ -613,7 +617,7 @@ function LocationButton() {
613617
}}
614618
>
615619
{loading ? (
616-
<div className="spinner" style={{ width: "22px", height: "22px", borderRadius: "50%", border: "2px solid #6272a4", borderTopColor: "transparent", animation: "spin 1s linear infinite" }} />
620+
<div className="spinner animate-spin" style={{ width: "22px", height: "22px", borderRadius: "50%", border: "2px solid #6272a4", borderTopColor: "transparent" }} />
617621
) : (
618622
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
619623
<circle cx="12" cy="12" r="10" />
@@ -815,6 +819,10 @@ const addCustomStyles = () => {
815819
100% { transform: rotate(360deg); }
816820
}
817821
822+
.animate-spin {
823+
animation: spin 1s linear infinite;
824+
}
825+
818826
.location-button:hover {
819827
background-color: #44475a !important;
820828
}

0 commit comments

Comments
 (0)