You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

167 lines
4.0 KiB

import React from 'react';
import { useNavigate } from 'react-router-dom';
import type { AccountMenuRowItem } from '../../data/accountData';
interface AccountMenuRowProps {
row: AccountMenuRowItem;
}
/**
* Reusable menu row on `shop-category` Account Overview (4214:345) and `provider requst` (4214:10531).
* - Dimensions: 317×34 at (29, row.y)
*/
export const AccountMenuRow: React.FC<AccountMenuRowProps> = ({ row }) => {
const navigate = useNavigate();
return (
<div
onClick={() => {
if (row.targetRoute) {
navigate(row.targetRoute);
}
}}
style={{
width: '100%',
minHeight: 38,
display: 'flex',
alignItems: 'center',
gap: 9,
cursor: row.targetRoute ? 'pointer' : 'default',
minWidth: 0,
}}
>
{/* Left 34×34 icon container (radius 11) */}
<div
style={{
position: 'relative',
width: 34,
height: 34,
borderRadius: 11,
backgroundColor: row.iconBoxBg,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
flexShrink: 0,
}}
>
<img
src={row.iconSrc}
alt=""
style={{
width: row.iconWidth,
height: row.iconHeight,
}}
/>
{/* Notification badge */}
{row.badgeCount && (
<div
style={{
position: 'absolute',
right: -6,
top: -8,
minWidth: 17,
height: 18,
padding: '0 4px',
borderRadius: 8,
backgroundColor: '#d44747',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<span
style={{
fontFamily: 'var(--font-sans)',
fontWeight: 400,
fontSize: 12,
lineHeight: '16px',
color: '#ffffff',
}}
>
{row.badgeCount}
</span>
</div>
)}
</div>
{/* Title & optional subtitle */}
<div
style={{
flex: 1,
minWidth: 0,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
gap: 2,
}}
>
<div
style={{
fontFamily: 'var(--font-sans)',
fontWeight: 600,
fontSize: 14,
lineHeight: '16px',
color: row.titleColor,
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
>
{row.title}
</div>
{row.subtitle && (
<div
style={{
fontFamily: 'var(--font-sans)',
fontWeight: 600,
fontSize: 10,
lineHeight: '12.9px',
color: '#73889d',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
>
{row.subtitle}
</div>
)}
</div>
{/* Right accessory icon */}
{row.rightIconType === 'edit-path' && (
<img
src="/assets/images/icon-menu-chevron-right-bold.svg"
alt=""
style={{
width: 18,
height: 18,
flexShrink: 0,
}}
/>
)}
{row.rightIconType === 'arrow-right' && (
<img
src="/assets/images/icon-menu-arrow-right.svg"
alt=""
style={{
width: 5,
height: 10,
flexShrink: 0,
}}
/>
)}
{row.rightIconType === 'external-link' && (
<img
src="/assets/images/icon-menu-contact-phone.svg"
alt=""
style={{
width: 12.25,
height: 12.25,
flexShrink: 0,
}}
/>
)}
</div>
);
};