import { Group, SimpleGrid, Stack, Text } from '@mantine/core'; import { useCommonHooks } from 'hooks'; import { textClasses } from 'styles'; import type { ExtendedForecast } from 'types'; import WeatherIcon from './WeatherIcon'; export default function ExtendedForecastCard({ forecast, }: { forecast: ExtendedForecast[]; }) { const { isMobile } = useCommonHooks(); const day = forecast.slice(2, 14).filter((item: ExtendedForecast) => item.isDaytime); const night = forecast.slice(2, 14).filter((item: ExtendedForecast) => !item.isDaytime); return ( Extended Forecast {day.map((item: ExtendedForecast, index: number) => { const short = item.shortForecast.includes('And') ? item.shortForecast.substring(0, item.shortForecast.indexOf('And')) : item.shortForecast.includes('then') ? item.shortForecast.substring(0, item.shortForecast.indexOf('then')) : item.shortForecast; return ( {item.name} 15 ? 'flex-start' : 'center'} style={{ width: '100%', whiteSpace: 'nowrap', overflow: 'hidden', boxSizing: 'border-box', position: 'relative', }} > 15 ? textClasses.autoScrollText : undefined} classNames={textClasses} > {short} {item.temperature}°{item.temperatureUnit}/{night[index].temperature}° {item.temperatureUnit} ); })} ); }