Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): improve responsive #19

Merged
merged 1 commit into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/layouts/calendar/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const PersianCalendar: React.FC = () => {

return (
<div className="flex flex-col justify-center w-full gap-3 mb-1 md:flex-row" dir="rtl">
<CalendarContainer className="w-full overflow-hidden md:flex-1">
<CalendarContainer className="w-full md:w-7/12 overflow-hidden md:flex-1">
<CalendarHeader
currentDate={currentDate}
setCurrentDate={setCurrentDate}
Expand All @@ -55,7 +55,7 @@ const PersianCalendar: React.FC = () => {
</div>
</CalendarContainer>

<CalendarContainer className="w-full md:w-80 p-3 md:p-4 h-auto min-h-[16rem] md:h-[27rem]">
<CalendarContainer className="w-full md:w-5/12 p-3 md:p-4">
<AnimatePresence mode="wait">
<CalendarContent
activeTab={activeTab}
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/search/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function SearchLayout() {

return (
<>
<div className="flex flex-col items-center justify-center max-h-80">
<div className="flex flex-col items-center justify-center">
<div className="relative w-full" ref={searchRef}>
<form className="w-full" onSubmit={handleSubmit}>
<div
Expand Down
56 changes: 29 additions & 27 deletions src/layouts/weather/components/current-box.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ export function CurrentWeatherBox({ weather }: CurrentWeatherBoxProps) {
},
},
}}
className={`h-full col-span-2 p-5 shadow-lg bg-gradient-to-br ${themeUtils.getCardBackground()} backdrop-blur-sm rounded-xl`}
className={`col-span-2 p-5 shadow-lg bg-gradient-to-br flex-2 ${themeUtils.getCardBackground()} backdrop-blur-sm rounded-xl`}
>
<div className="flex flex-row-reverse items-start justify-between gap-4">
<motion.div
className="relative group"
variants={fadeInUp}
whileHover={{ scale: 1.1 }}
transition={{ type: 'spring', stiffness: 300 }}
whileHover={{scale: 1.1}}
transition={{type: 'spring', stiffness: 300}}
>
<img
src={weather.icon.url}
Expand All @@ -135,25 +135,27 @@ export function CurrentWeatherBox({ weather }: CurrentWeatherBoxProps) {
{unitsFlag[weatherSettings.temperatureUnit || 'metric']}
</span>
</motion.span>
</div>
</div>

<motion.div
variants={fadeInUp}
className="flex flex-wrap items-center gap-2 mt-3"
<div className="flex mt-1">
<motion.div
variants={fadeInUp}
className="flex flex-wrap items-center gap-2 mt-3"
>
<div
className={`px-3 py-1.5 flex items-center gap-2 text-sm font-medium rounded-full transition-all hover:shadow-md ${getHumidityPillStyle()}`}
>
<div
className={`px-3 py-1.5 flex items-center gap-2 text-sm font-medium rounded-full transition-all hover:shadow-md ${getHumidityPillStyle()}`}
>
<WiHumidity size={20} className="flex-shrink-0" />
<span>{weather.temperature.humidity}%</span>
</div>
<div
className={`px-3 py-1.5 flex items-center gap-2 text-sm font-medium rounded-full transition-all hover:shadow-md ${getWindPillStyle()}`}
>
<WiStrongWind size={20} className="flex-shrink-0" />
<span>{weather.temperature.wind_speed} m/s</span>
</div>
</motion.div>
</div>
<WiHumidity size={20} className="flex-shrink-0"/>
<span>{weather.temperature.humidity}%</span>
</div>
<div
className={`px-3 py-1.5 flex items-center gap-2 text-sm font-medium rounded-full transition-all hover:shadow-md ${getWindPillStyle()}`}
>
<WiStrongWind size={20} className="flex-shrink-0"/>
<span>{weather.temperature.wind_speed} m/s</span>
</div>
</motion.div>
</div>

<motion.div
Expand All @@ -165,11 +167,11 @@ export function CurrentWeatherBox({ weather }: CurrentWeatherBoxProps) {
{weather.ai?.description && (
<motion.div
className="absolute flex items-center gap-2 left-4 top-0 p-1.5"
initial={{ opacity: 0, x: -10 }}
animate={{ opacity: 1, x: 0 }}
transition={{ delay: 0.5 }}
initial={{opacity: 0, x: -10}}
animate={{opacity: 1, x: 0}}
transition={{delay: 0.5}}
>
<BsRobot className={`text-xl ${getAiIconStyle()}`} />
<BsRobot className={`text-xl ${getAiIconStyle()}`}/>
</motion.div>
)}

Expand All @@ -182,9 +184,9 @@ export function CurrentWeatherBox({ weather }: CurrentWeatherBoxProps) {

{weather.ai?.playlist && (
<motion.a
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ delay: 0.7 }}
initial={{opacity: 0, scale: 0.9}}
animate={{opacity: 1, scale: 1}}
transition={{delay: 0.7}}
href={weather.ai.playlist}
target="_blank"
rel="noopener noreferrer"
Expand Down
8 changes: 4 additions & 4 deletions src/layouts/weather/weather.layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ export function WeatherLayout() {

return (
<>
<section className="rounded">
<div className="flex flex-col gap-2">
<section className="rounded h-full">
<div className="flex flex-col gap-2 h-full">
{cityWeather ? <CurrentWeatherBox weather={cityWeather.weather} /> : null}

<motion.div
className="relative p-1 mt-2 overflow-hidden"
className="relative p-1 lg:pb-0 mt-2 overflow-hidden flex-1"
initial={{ opacity: 0.9 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.3 }}
Expand All @@ -101,7 +101,7 @@ export function WeatherLayout() {
nextEl: '.swiper-button-next-custom',
prevEl: '.swiper-button-prev-custom',
}}
className="py-2 weather-forecast-slider"
className="pt-2 weather-forecast-slider"
dir="ltr"
>
{forecast?.map((item, index) => (
Expand Down
8 changes: 4 additions & 4 deletions src/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ function ContentSection() {
</div>
</div>

<div className="flex flex-col w-full gap-3 md:flex-row md:gap-4">
<div className="w-full md:w-2/3">
<div className="flex flex-col w-full flex-wrap lg:flex-nowrap gap-3 md:flex-row md:gap-4">
<div className="w-full lg:w-8/12">
<CalendarLayout />
</div>
<div className="w-full md:w-1/3">
<div className="w-full lg:w-4/12">
<WeatherLayout />
</div>
</div>
Expand Down Expand Up @@ -174,7 +174,7 @@ export function HomePage() {
}

return (
<div className="w-full min-h-screen px-2 mx-auto md:px-4 lg:px-0 max-w-[1080px] flex flex-col">
<div className="w-full min-h-screen px-2 mx-auto md:px-4 lg:px-0 max-w-[1080px] flex flex-col gap-4">
<GeneralSettingProvider>
<WeatherProvider>
<NavbarLayout />
Expand Down