Skip to content

Commit 6088cf9

Browse files
committed
feat: enhance CurrentWeatherBox styling with transition effects and improved gradient masks
1 parent 1f146d2 commit 6088cf9

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/layouts/widgets/weather/current/current-box.weather.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@ export function CurrentWeatherBox({
1919
}: CurrentWeatherBoxProps) {
2020
return (
2121
<>
22-
<div className="relative p-2 overflow-hidden border rounded-2xl border-content min-h-28 max-h-28">
22+
<div
23+
className={`relative p-2 overflow-hidden border ${fetchedWeather?.statusBanner && 'border-r-0'} rounded-2xl border-content min-h-28 max-h-28`}
24+
>
2325
{fetchedWeather?.statusBanner && (
2426
<div
25-
className="absolute inset-0 bg-center bg-cover"
27+
className="absolute inset-0 transition-opacity duration-500 bg-center bg-cover"
2628
style={{
2729
backgroundImage: `url(${fetchedWeather.statusBanner})`,
2830
maskImage:
29-
'linear-gradient(to left, rgba(0, 0, 0, 0.4) 10%, rgba(0, 0, 0, 0) 80%)',
31+
'linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.6) 30%, rgba(0, 0, 0, 0.3) 60%, rgba(0, 0, 0, 0) 85%)',
3032
WebkitMaskImage:
31-
'linear-gradient(to left, rgba(0, 0, 0, 0.4) 10%, rgba(0, 0, 0, 0) 80%)',
33+
'linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.6) 30%, rgba(0, 0, 0, 0.3) 60%, rgba(0, 0, 0, 0) 85%)',
3234
}}
3335
/>
3436
)}
@@ -51,8 +53,8 @@ export function CurrentWeatherBox({
5153
</span>
5254

5355
<span className="text-xs leading-tight text-muted drop-shadow-lg">
54-
{fetchedWeather?.description.text}{' '}
55-
{fetchedWeather?.temperature.temp_description}
56+
{fetchedWeather?.description?.text}{' '}
57+
{fetchedWeather?.temperature?.temp_description}
5658
</span>
5759
</div>
5860

@@ -70,7 +72,7 @@ export function CurrentWeatherBox({
7072
<div className="flex items-center justify-center gap-1.5 py-2 transition-colors border rounded-xl border-content">
7173
<TbWind className="w-4 h-4 text-muted" />
7274
<span className="text-xs font-medium text-muted">
73-
{Math.round(fetchedWeather?.temperature.wind_speed || 0)}{' '}
75+
{Math.round(fetchedWeather?.temperature?.wind_speed || 0)}{' '}
7476
m/s
7577
</span>
7678
</div>
@@ -80,7 +82,7 @@ export function CurrentWeatherBox({
8082
<div className="flex items-center justify-center gap-1.5 py-2 transition-colors border rounded-xl border-content">
8183
<WiHumidity className="w-4 h-4 text-muted" />
8284
<span className="text-xs font-medium text-muted">
83-
{fetchedWeather?.temperature.humidity || 0}%
85+
{fetchedWeather?.temperature?.humidity || 0}%
8486
</span>
8587
</div>
8688
</Tooltip>
@@ -89,7 +91,7 @@ export function CurrentWeatherBox({
8991
<div className="flex items-center justify-center gap-1.5 py-2 transition-colors border rounded-xl border-content">
9092
<WiCloudy className="w-4 h-4 text-muted" />
9193
<span className="text-xs font-medium text-muted">
92-
{fetchedWeather?.temperature.clouds || 0}%
94+
{fetchedWeather?.temperature?.clouds || 0}%
9395
</span>
9496
</div>
9597
</Tooltip>

0 commit comments

Comments
 (0)