Signed-off-by: mbrucedogs <mbrucedogs@gmail.com>
This commit is contained in:
parent
43bb456058
commit
318707b990
@ -2,6 +2,7 @@ import React, { forwardRef, useMemo } from 'react';
|
||||
import { IonItem, IonLabel, IonIcon } from '@ionic/react';
|
||||
import { chevronForward } from 'ionicons/icons';
|
||||
import type { Song } from '../../types';
|
||||
import { NumberDisplay } from './NumberDisplay';
|
||||
|
||||
// Generic ListItem interface for different types of data
|
||||
interface GenericListItemProps {
|
||||
@ -18,6 +19,7 @@ interface GenericListItemProps {
|
||||
button?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
endContent?: React.ReactNode;
|
||||
showSeparator?: boolean;
|
||||
}
|
||||
|
||||
// Song-specific ListItem interface
|
||||
@ -55,7 +57,8 @@ export const ListItem = React.memo(forwardRef<HTMLIonItemElement, GenericListIte
|
||||
detail = false,
|
||||
button = false,
|
||||
style,
|
||||
endContent
|
||||
endContent,
|
||||
showSeparator, // keep for API compatibility, but not used
|
||||
}, ref) => {
|
||||
return (
|
||||
<IonItem
|
||||
@ -65,45 +68,31 @@ export const ListItem = React.memo(forwardRef<HTMLIonItemElement, GenericListIte
|
||||
button={button || !!onClick}
|
||||
detail={detail}
|
||||
slot={slot}
|
||||
style={style}
|
||||
>
|
||||
<div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
|
||||
{showNumber && number !== undefined && (
|
||||
<IonLabel slot="start" className="flex-shrink-0 mr-4" style={{ flex: '0 0 auto' }}>
|
||||
<div className="text-lg font-bold text-gray-500">
|
||||
{number}
|
||||
</div>
|
||||
</IonLabel>
|
||||
)}
|
||||
<IonLabel style={{ flex: '1 1 0%', margin: '0 10px' }}>
|
||||
<div
|
||||
className="ion-text-bold"
|
||||
style={{
|
||||
fontWeight: 'bold',
|
||||
fontSize: '1rem',
|
||||
color: 'var(--ion-color-dark)',
|
||||
marginBottom: '4px'
|
||||
...style,
|
||||
minHeight: '60px',
|
||||
'--padding-start': '16px', // Add left padding for classic Ionic look
|
||||
'--min-height': '60px',
|
||||
}}
|
||||
>
|
||||
{/* Number (if enabled) */}
|
||||
{showNumber && number !== undefined && (
|
||||
<NumberDisplay number={number} />
|
||||
)}
|
||||
{/* Main content */}
|
||||
<IonLabel>
|
||||
<div style={{ fontWeight: 'bold', fontSize: '1rem', color: 'var(--ion-color-dark)', marginBottom: 2, overflow: 'hidden', textOverflow: 'ellipsis', wordBreak: 'break-word' }}>
|
||||
{primaryText}
|
||||
</div>
|
||||
{secondaryText && (
|
||||
<div
|
||||
className="ion-text-italic ion-color-medium"
|
||||
style={{
|
||||
fontSize: '0.875rem',
|
||||
fontStyle: 'italic',
|
||||
color: 'var(--ion-color-medium)',
|
||||
marginBottom: '4px'
|
||||
}}
|
||||
>
|
||||
<div style={{ fontSize: '0.875rem', fontStyle: 'italic', color: 'var(--ion-color-medium)', overflow: 'hidden', textOverflow: 'ellipsis', wordBreak: 'break-word' }}>
|
||||
{secondaryText}
|
||||
</div>
|
||||
)}
|
||||
</IonLabel>
|
||||
<div style={{ flex: '0 0 auto' }}>{children}</div>
|
||||
<div style={{ flex: '0 0 auto' }}>{endContent}</div>
|
||||
</div>
|
||||
{/* End content */}
|
||||
{children && <div style={{ flex: '0 0 auto', marginRight: 8 }}>{children}</div>}
|
||||
{endContent && <div style={{ flex: '0 0 auto' }}>{endContent}</div>}
|
||||
{showChevron && (
|
||||
<IonIcon
|
||||
slot="end"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user