fix(home): prevent bento grid overflow on narrow viewports
All checks were successful
Deploy / deploy (push) Successful in 2m40s
All checks were successful
Deploy / deploy (push) Successful in 2m40s
CSS grid items default min-width to min-content; the tram widget 3-col subgrid plus its баbadges and long затем text forced its cell wider than 1.1fr, collapsing the outer layout on tablet. Fixes: - outer bento row → gridTemplateColumns: minmax(0, 1fr) minmax(0, 1.1fr) - events+notes row same treatment - TransportWidget inner subgrids: 58px → 52px badge, 1fr → minmax(0, 1fr) - Cell: minWidth: 0, overflow: hidden, затем text trimmed with ellipsis and short м suffix (5м instead of 5 мин) - big number 32→28px, badge 22→20px to fit in denser columns
This commit is contained in:
@@ -419,7 +419,7 @@ function HomeTab({ weather, sensors }: { weather: WeatherData | null; sensors: S
|
|||||||
display: 'flex', flexDirection: 'column', gap: 14,
|
display: 'flex', flexDirection: 'column', gap: 14,
|
||||||
}}>
|
}}>
|
||||||
{/* ───── Bento row: Hero weather + Tram ───── */}
|
{/* ───── Bento row: Hero weather + Tram ───── */}
|
||||||
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1.1fr', gap: 14, minHeight: 230 }}>
|
<div style={{ display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 1.1fr)', gap: 14, alignItems: 'stretch' }}>
|
||||||
|
|
||||||
{/* Hero weather card */}
|
{/* Hero weather card */}
|
||||||
{weather ? (
|
{weather ? (
|
||||||
@@ -554,7 +554,7 @@ function HomeTab({ weather, sensors }: { weather: WeatherData | null; sensors: S
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* ───── Events + Notes row ───── */}
|
{/* ───── Events + Notes row ───── */}
|
||||||
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 14 }}>
|
<div style={{ display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 1fr)', gap: 14 }}>
|
||||||
|
|
||||||
{/* Events — today + tomorrow in one card */}
|
{/* Events — today + tomorrow in one card */}
|
||||||
<div className="card" style={{ padding: '18px 20px', display: 'flex', flexDirection: 'column', gap: 14 }}>
|
<div className="card" style={{ padding: '18px 20px', display: 'flex', flexDirection: 'column', gap: 14 }}>
|
||||||
|
|||||||
@@ -45,18 +45,18 @@ function Cell({ arrivals, color }: { arrivals: Arrival[]; color: string }) {
|
|||||||
const imminent = first.minutes <= 2
|
const imminent = first.minutes <= 2
|
||||||
return (
|
return (
|
||||||
<div style={{
|
<div style={{
|
||||||
display: 'flex', alignItems: 'center', gap: 12,
|
display: 'flex', alignItems: 'center', gap: 10,
|
||||||
padding: '10px 14px', borderRadius: 12,
|
padding: '10px 12px', borderRadius: 12,
|
||||||
background: imminent ? `color-mix(in srgb, ${color} 10%, var(--surface-2))` : 'var(--surface-2)',
|
background: imminent ? `color-mix(in srgb, ${color} 10%, var(--surface-2))` : 'var(--surface-2)',
|
||||||
border: `1px solid ${imminent ? color : 'var(--border-subtle)'}`,
|
border: `1px solid ${imminent ? color : 'var(--border-subtle)'}`,
|
||||||
minHeight: 56,
|
minHeight: 56, minWidth: 0, overflow: 'hidden',
|
||||||
transition: 'all 0.3s ease',
|
transition: 'all 0.3s ease',
|
||||||
}}>
|
}}>
|
||||||
{/* Primary time — big */}
|
{/* Primary time — big */}
|
||||||
<div style={{ display: 'flex', alignItems: 'baseline', gap: 4, flexShrink: 0 }}>
|
<div style={{ display: 'flex', alignItems: 'baseline', gap: 3, flexShrink: 0 }}>
|
||||||
<div style={{
|
<div style={{
|
||||||
fontSize: first.minutes <= 0 ? 18 : 32,
|
fontSize: first.minutes <= 0 ? 16 : 28,
|
||||||
fontWeight: 800, letterSpacing: '-1.5px', lineHeight: 1,
|
fontWeight: 800, letterSpacing: '-1px', lineHeight: 1,
|
||||||
color: imminent ? color : 'var(--text-primary)',
|
color: imminent ? color : 'var(--text-primary)',
|
||||||
fontVariantNumeric: 'tabular-nums',
|
fontVariantNumeric: 'tabular-nums',
|
||||||
}}>
|
}}>
|
||||||
@@ -78,10 +78,11 @@ function Cell({ arrivals, color }: { arrivals: Arrival[]; color: string }) {
|
|||||||
затем
|
затем
|
||||||
</div>
|
</div>
|
||||||
<div style={{
|
<div style={{
|
||||||
fontSize: 13, color: 'var(--text-secondary)', fontWeight: 600,
|
fontSize: 12, color: 'var(--text-secondary)', fontWeight: 600,
|
||||||
fontVariantNumeric: 'tabular-nums',
|
fontVariantNumeric: 'tabular-nums',
|
||||||
|
overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
|
||||||
}}>
|
}}>
|
||||||
{rest.map(r => r.minutes <= 0 ? 'сейчас' : `${r.minutes} мин`).join(' · ')}
|
{rest.map(r => r.minutes <= 0 ? 'сейчас' : `${r.minutes}м`).join(' · ')}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@@ -123,7 +124,7 @@ export default function TransportWidget() {
|
|||||||
<div className="card-hero" style={{
|
<div className="card-hero" style={{
|
||||||
padding: '18px 20px',
|
padding: '18px 20px',
|
||||||
display: 'flex', flexDirection: 'column', gap: 14,
|
display: 'flex', flexDirection: 'column', gap: 14,
|
||||||
height: '100%',
|
minWidth: 0,
|
||||||
}}>
|
}}>
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
||||||
@@ -155,7 +156,7 @@ export default function TransportWidget() {
|
|||||||
{/* Column headers */}
|
{/* Column headers */}
|
||||||
<div style={{
|
<div style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '58px 1fr 1fr',
|
gridTemplateColumns: '52px minmax(0, 1fr) minmax(0, 1fr)',
|
||||||
gap: 10,
|
gap: 10,
|
||||||
paddingBottom: 6,
|
paddingBottom: 6,
|
||||||
borderBottom: '1px solid var(--hairline)',
|
borderBottom: '1px solid var(--hairline)',
|
||||||
@@ -181,17 +182,18 @@ export default function TransportWidget() {
|
|||||||
{ROUTES.map(route => (
|
{ROUTES.map(route => (
|
||||||
<div key={route.num} style={{
|
<div key={route.num} style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: '58px 1fr 1fr',
|
gridTemplateColumns: '52px minmax(0, 1fr) minmax(0, 1fr)',
|
||||||
gap: 10,
|
gap: 10,
|
||||||
alignItems: 'stretch',
|
alignItems: 'stretch',
|
||||||
|
minWidth: 0,
|
||||||
}}>
|
}}>
|
||||||
<div style={{
|
<div style={{
|
||||||
background: route.bg,
|
background: route.bg,
|
||||||
boxShadow: `0 6px 16px -4px ${route.color}55`,
|
boxShadow: `0 6px 16px -4px ${route.color}55`,
|
||||||
borderRadius: 13,
|
borderRadius: 12,
|
||||||
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||||
color: 'white', fontWeight: 800, fontSize: 22,
|
color: 'white', fontWeight: 800, fontSize: 20,
|
||||||
letterSpacing: '-1.5px',
|
letterSpacing: '-1px',
|
||||||
minHeight: 56,
|
minHeight: 56,
|
||||||
}}>
|
}}>
|
||||||
{route.num}
|
{route.num}
|
||||||
|
|||||||
Reference in New Issue
Block a user