Skip to content

Commit

Permalink
Set default value for size property
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelroth committed Oct 2, 2023
1 parent 5680f47 commit 0fc31a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions client/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import WeatherOverview from "./lib/WeatherOverview.svelte";
import { getForecastPoint } from "./lib/utils";
export let size;
export let size = "S";
export let geolocation;
export let locationName;
export let forecastPoint;
Expand All @@ -12,12 +12,12 @@
<TailwindCss />
<main class="flex justify-center mt-2">
{#if forecastPoint}
<WeatherOverview weatherData={forecastPoint} {size} />
<WeatherOverview weatherData={forecastPoint} size={size.toUpperCase()} />
{:else}
{#await getForecastPoint(geolocation, locationName)}
<p>Loading...</p>
{:then weatherData}
<WeatherOverview {weatherData} {size} />
<WeatherOverview {weatherData} size={size.toUpperCase()} />
{:catch}
<p>Error fetching data</p>
{/await}
Expand Down
7 changes: 4 additions & 3 deletions client/src/lib/WeatherOverview.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
/>
</div>
</div>
{#if ["L", "M"].includes(size.toUpperCase())}
{#if ["L", "M"].includes(size)}
<div
class="flex flex-row ml-6 space-x-6 overflow-scroll text-xs font-bold scrollbar-hide"
>
Expand All @@ -49,17 +49,18 @@
? "Jetzt"
: new Date(hours.date_time).toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
minute: "2-digit"
})}
symbol={hours.symbol_code}
dimensions="w-6 h-6"
dailyTemp={hours.TTT_C}
rainInMM={hours.RRR_MM}
{size}
/>
{/if}
{/each}
</div>
{:else if size.toUpperCase() === "L"}{/if}
{/if}
</div>

<style>
Expand Down

0 comments on commit 0fc31a1

Please sign in to comment.