pertama dan terakhir
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* style.util.js
|
||||
* Tanggung Jawab: Mendefinisikan style untuk GeoJSON berdasarkan properti.
|
||||
*/
|
||||
|
||||
export const getGeoJsonStyle = (feature) => {
|
||||
// Style default untuk Kavling (Polygon)
|
||||
if (feature.geometry.type === 'Polygon') {
|
||||
return {
|
||||
color: '#10B981', // Secondary color
|
||||
weight: 2,
|
||||
opacity: 0.8,
|
||||
fillColor: '#34D399',
|
||||
fillOpacity: 0.4
|
||||
};
|
||||
}
|
||||
|
||||
// Style default untuk Jalan (LineString)
|
||||
if (feature.geometry.type === 'LineString') {
|
||||
const type = feature.properties.jenis_jalan;
|
||||
let color = '#4F46E5'; // Primary color
|
||||
|
||||
if (type === 'Arteri') color = '#EF4444'; // Danger color
|
||||
else if (type === 'Kolektor') color = '#F59E0B'; // Warning color
|
||||
|
||||
return {
|
||||
color: color,
|
||||
weight: 4,
|
||||
opacity: 0.9
|
||||
};
|
||||
}
|
||||
|
||||
return {};
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* ui.util.js
|
||||
* Tanggung Jawab: Manipulasi DOM umum seperti Toast notification.
|
||||
*/
|
||||
|
||||
export const showToast = (message, type = 'success') => {
|
||||
const container = document.getElementById('toast-container');
|
||||
if (!container) return;
|
||||
|
||||
const toast = document.createElement('div');
|
||||
toast.className = `toast ${type}`;
|
||||
toast.textContent = message;
|
||||
|
||||
container.appendChild(toast);
|
||||
|
||||
// Hapus toast setelah 3 detik
|
||||
setTimeout(() => {
|
||||
toast.style.opacity = '0';
|
||||
toast.style.transform = 'translateY(20px)';
|
||||
toast.style.transition = 'all 0.3s ease';
|
||||
|
||||
setTimeout(() => toast.remove(), 300);
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
export const clearFormContainer = () => {
|
||||
const container = document.getElementById('form-container');
|
||||
if (container) {
|
||||
container.innerHTML = '';
|
||||
container.style.display = 'none';
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user