fix: improve amenity icon display on room cards
- Icons now render with proper size (14px) inside pill badges - Show amenity name next to icon for clarity - Use regex for robust width/height replacement - Compact layout with smaller gaps and font sizes - Better text wrapping with whiteSpace: nowrap
This commit is contained in:
+12
-6
@@ -433,26 +433,32 @@ export default function RoomsPage() {
|
|||||||
|
|
||||||
{/* ─── Amenity Icons ─── */}
|
{/* ─── Amenity Icons ─── */}
|
||||||
{room.amenities && room.amenities.length > 0 && (
|
{room.amenities && room.amenities.length > 0 && (
|
||||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.5rem', marginTop: '0.75rem' }}>
|
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.4rem', marginTop: '0.75rem' }}>
|
||||||
{room.amenities.slice(0, 6).map((amenity) => (
|
{room.amenities.slice(0, 6).map((amenity) => (
|
||||||
<div
|
<div
|
||||||
key={amenity.id}
|
key={amenity.id}
|
||||||
title={amenity.name}
|
title={amenity.name}
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'inline-flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
gap: '0.25rem',
|
gap: '0.25rem',
|
||||||
padding: '0.35rem 0.6rem',
|
padding: '0.3rem 0.5rem',
|
||||||
background: 'rgba(1,13,30,0.06)',
|
background: 'rgba(1,13,30,0.06)',
|
||||||
borderRadius: '999px',
|
borderRadius: '999px',
|
||||||
fontSize: '12px',
|
fontSize: '11px',
|
||||||
color: navy,
|
color: navy,
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
}}
|
}}
|
||||||
dangerouslySetInnerHTML={{ __html: amenity.icon_svg.replace('width="24"', 'width="14"').replace('height="24"', 'height="14"') }}
|
>
|
||||||
|
<span
|
||||||
|
style={{ display: 'inline-flex', alignItems: 'center', width: '14px', height: '14px' }}
|
||||||
|
dangerouslySetInnerHTML={{ __html: amenity.icon_svg.replace(/width="[^"]*"/, 'width="14"').replace(/height="[^"]*"/, 'height="14"') }}
|
||||||
/>
|
/>
|
||||||
|
<span>{amenity.name}</span>
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
{room.amenities.length > 6 && (
|
{room.amenities.length > 6 && (
|
||||||
<span style={{ fontSize: '11px', color: '#777', alignSelf: 'center' }}>+{room.amenities.length - 6} more</span>
|
<span style={{ fontSize: '10px', color: '#777', alignSelf: 'center', padding: '0 0.5rem' }}>+{room.amenities.length - 6}</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user