mani-agro-frontend/src/components/common/Header/MobileDrawer.tsx

143 lines
4.0 KiB
TypeScript

import React from 'react';
import {
Drawer,
Box,
Typography,
IconButton,
List,
ListItem,
ListItemButton,
ListItemText,
Divider,
Button,
} from '@mui/material';
import { X, FileText } from 'lucide-react';
import { WhatsAppIcon as MessageCircle } from '../WhatsAppIcon';
import { useNavigate } from 'react-router-dom';
import { COMPANY_INFO } from '../../../data/companyData';
import { useQuote } from '../../../context/QuoteContext';
interface MobileDrawerProps {
open: boolean;
onClose: () => void;
navLinks: Array<{ label: string; path: string }>;
}
export const MobileDrawer: React.FC<MobileDrawerProps> = ({ open, onClose, navLinks }) => {
const { openQuoteModal } = useQuote();
const navigate = useNavigate();
const handleNavClick = (path: string) => {
onClose();
navigate(path);
};
const handleQuoteClick = () => {
onClose();
openQuoteModal();
};
return (
<Drawer
anchor="right"
open={open}
onClose={onClose}
slotProps={{
paper: {
sx: {
width: '85%',
maxWidth: 340,
bgcolor: '#102A22',
color: '#FFFFFF',
p: 3,
},
},
}}
>
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 3 }}>
<Box>
<Typography variant="h6" sx={{ color: '#FFFFFF', fontWeight: 800, letterSpacing: '0.05em' }}>
MANI AGRO
</Typography>
<Typography variant="caption" sx={{ color: '#D49B24', letterSpacing: '0.1em' }}>
EXPORTS INDIA
</Typography>
</Box>
<IconButton onClick={onClose} sx={{ color: 'rgba(255, 255, 255, 0.8)' }}>
<X size={22} />
</IconButton>
</Box>
<Divider sx={{ borderColor: 'rgba(255, 255, 255, 0.1)', mb: 2 }} />
<List sx={{ p: 0 }}>
{navLinks.map((link) => (
<ListItem key={link.path} disablePadding sx={{ mb: 1 }}>
<ListItemButton
onClick={() => handleNavClick(link.path)}
sx={{
borderRadius: 2,
py: 1.2,
px: 2,
'&:hover': { bgcolor: 'rgba(255, 255, 255, 0.08)' },
}}
>
<ListItemText
primary={
<Typography sx={{ fontWeight: 600, fontSize: '1.05rem', color: '#FFFFFF' }}>
{link.label}
</Typography>
}
/>
</ListItemButton>
</ListItem>
))}
</List>
<Divider sx={{ borderColor: 'rgba(255, 255, 255, 0.1)', my: 2 }} />
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2, mt: 'auto', pt: 2 }}>
<Button
variant="contained"
color="secondary"
fullWidth
startIcon={<FileText size={18} />}
onClick={handleQuoteClick}
sx={{ py: 1.3, fontWeight: 700 }}
>
Request B2B Quote
</Button>
<Button
variant="outlined"
fullWidth
href={COMPANY_INFO.whatsappUrl}
target="_blank"
rel="noopener noreferrer"
startIcon={<MessageCircle size={18} color="#25D366" />}
sx={{
borderColor: 'rgba(37, 211, 102, 0.5)',
color: '#FFFFFF',
py: 1.2,
'&:hover': {
borderColor: '#25D366',
bgcolor: 'rgba(37, 211, 102, 0.1)',
},
}}
>
WhatsApp Direct
</Button>
<Box sx={{ pt: 2, borderTop: '1px solid rgba(255, 255, 255, 0.08)' }}>
<Typography variant="caption" sx={{ color: 'rgba(255, 255, 255, 0.6)', display: 'block', mb: 0.5 }}>
Export Desk: {COMPANY_INFO.person}
</Typography>
<Typography variant="body2" sx={{ color: '#D49B24', fontWeight: 600 }}>
{COMPANY_INFO.phoneDisplay}
</Typography>
</Box>
</Box>
</Drawer>
);
};