Files
Alberto-Audrix 32a36cceff
CI / lint-and-test (push) Canceled after 0s
first commit
2026-07-28 08:55:05 +07:00

62 lines
2.4 KiB
TypeScript

import React from 'react';
import { Screen, AlertSeverity } from '../../types.ts';
import { InfoIcon, WarningIcon, CriticalIcon } from '../icons/Icons.tsx';
// Helper Components
export const PhoneShell: React.FC<{ children: React.ReactNode }> = ({ children }) => (
<div className="bg-gray-800 border-gray-900 border-4 rounded-[40px] h-[600px] w-[300px] shadow-2xl mx-auto flex-shrink-0">
<div className="h-full w-full bg-black rounded-[36px] overflow-hidden relative">
<div className="absolute top-0 left-1/2 -translate-x-1/2 w-28 h-6 bg-gray-800 rounded-b-xl z-20"></div>
{children}
</div>
</div>
);
export const MobileHeader = () => (
<div className="px-4 py-2 flex justify-between items-center text-xs font-mono text-gray-700 absolute top-0 left-0 right-0 z-10 bg-gray-50/80 backdrop-blur-sm">
<span>09:41</span>
<span>
<i className="fa-solid fa-signal"></i> <i className="fa-solid fa-wifi"></i>{' '}
<i className="fa-solid fa-battery-three-quarters"></i>
</span>
</div>
);
export const MobileBottomNav: React.FC<{
active: Screen;
onNavigate: (screen: Screen) => void;
}> = ({ active, onNavigate }) => {
const navItems = [
{ name: 'Home', screen: 'home' as Screen, icon: 'fa-home' },
{ name: 'Notifikasi', screen: 'alerts' as Screen, icon: 'fa-bell' },
{ name: 'Peta', screen: 'map' as Screen, icon: 'fa-map' },
{ name: 'Laporan', screen: 'reports' as Screen, icon: 'fa-chart-line' },
];
return (
<div className="absolute bottom-0 left-0 right-0 h-16 bg-white border-t border-gray-200 flex justify-around items-center z-10">
{navItems.map((item) => (
<button
key={item.name}
onClick={() => onNavigate(item.screen)}
className={`flex flex-col items-center justify-center w-full ${active === item.screen ? 'text-red-600' : 'text-gray-500'}`}
>
<i className={`fa-solid ${item.icon} text-xl`}></i>
<span className="text-xs mt-1">{item.name}</span>
</button>
))}
</div>
);
};
export const severityMobileConfig = {
[AlertSeverity.INFO]: { icon: <InfoIcon className="text-blue-500" />, border: 'border-blue-500' },
[AlertSeverity.WARNING]: {
icon: <WarningIcon className="text-yellow-500" />,
border: 'border-yellow-500',
},
[AlertSeverity.CRITICAL]: {
icon: <CriticalIcon className="text-red-500" />,
border: 'border-red-500',
},
};