// HIFA OIL Loyalty — App chrome: top bar, bottom nav, sheet, fuel bar
// ── Top app bar ───────────────────────────────────────────────
function AppBar({ variant = 'home', title, currency = 'BA', onMenu, onBack, onCurrency, onSettings, onFav }) {
const iconBtn = (name, onClick, opts = {}) => (
);
return (
{variant === 'home'
? iconBtn('menu', onMenu, { stroke: 2.4 })
: iconBtn('chevron-left', onBack, { size: 26, stroke: 2.4 })}
{variant === 'home' ? (
{currency}
) : (
{title}
)}
{iconBtn('settings', onSettings, { stroke: 2 })}
{iconBtn('star', onFav, { fill: 'var(--hifa-gold)', stroke: 0 })}
);
}
// ── Bottom navigation (5 tabs, raised gold center) ────────────
function BottomNav({ active, onChange }) {
const tabs = [
{ id: 'home', label: 'Početna', icon: 'house' },
{ id: 'nearby', label: 'U blizini', icon: 'locate-fixed' },
{ id: 'card', label: 'Kartica', icon: 'qr-code', center: true },
{ id: 'catalog', label: 'Katalog', icon: 'newspaper' },
{ id: 'profile', label: 'Profil', icon: 'user' },
];
return (
{tabs.map(t => {
const on = active === t.id;
if (t.center) {
return (
onChange(t.id)}
style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 5,
flex: 1, marginTop: -26 }}>
{t.label}
);
}
return (
onChange(t.id)}
style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 5, flex: 1, padding: '4px 0' }}>
{t.label}
);
})}
);
}
// ── Fuel balance bar ──────────────────────────────────────────
function FuelBar({ value, max, big = false }) {
const pct = Math.min(100, (value / max) * 100);
return (
);
}
// ── Bottom sheet / modal ──────────────────────────────────────
function Sheet({ open, onClose, title, children }) {
return (
{title &&
{title}
}
{children}
);
}
Object.assign(window, { AppBar, BottomNav, FuelBar, Sheet });