CSS school kaitlyns demands
All checks were successful
Rebuild signaller for deprived.dev to rebuild site / Rebuild Signaller (push) Successful in 22s
All checks were successful
Rebuild signaller for deprived.dev to rebuild site / Rebuild Signaller (push) Successful in 22s
This commit is contained in:
parent
8d3e7af85f
commit
6ec52a6ad2
1 changed files with 68 additions and 19 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
import iso3 from "./iso3.json";
|
import iso3 from "./iso3.json";
|
||||||
import countryList from "country-list-js";
|
import countryList from "country-list-js";
|
||||||
import onMount from "@src/optimizers/onMount";
|
import onMount from "@src/optimizers/onMount";
|
||||||
|
import Search from "lucide-svelte/icons/search";
|
||||||
|
|
||||||
class Range {
|
class Range {
|
||||||
start: number = 0;
|
start: number = 0;
|
||||||
|
|
@ -25,6 +26,17 @@
|
||||||
let currentCountry: string = "";
|
let currentCountry: string = "";
|
||||||
let currentCountrySelected: string = "";
|
let currentCountrySelected: string = "";
|
||||||
let interactiveEmbed: HTMLIFrameElement;
|
let interactiveEmbed: HTMLIFrameElement;
|
||||||
|
let searchFilter: string = "";
|
||||||
|
|
||||||
|
interface RegionFilter {
|
||||||
|
region: string;
|
||||||
|
selected: boolean;
|
||||||
|
}
|
||||||
|
const continents: string[] = countryList.continents();
|
||||||
|
const regionFilters: RegionFilter[] = continents.map((name) => ({
|
||||||
|
region: name,
|
||||||
|
selected: false,
|
||||||
|
}));
|
||||||
|
|
||||||
function selectCountry(country: string, towards: boolean) {
|
function selectCountry(country: string, towards: boolean) {
|
||||||
currentCountry =
|
currentCountry =
|
||||||
|
|
@ -152,8 +164,36 @@
|
||||||
>
|
>
|
||||||
</iframe>
|
</iframe>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-[40%]">
|
<div class="w-[60%]">
|
||||||
|
<div class="flex justify-between">
|
||||||
<div class="text-2xl">List of interactive graphs</div>
|
<div class="text-2xl">List of interactive graphs</div>
|
||||||
|
<div class="join">
|
||||||
|
<button
|
||||||
|
class="btn btn-outline btn-disabled btn-accent join-item grid items-center justify-center"
|
||||||
|
>
|
||||||
|
<Search />
|
||||||
|
</button>
|
||||||
|
<input
|
||||||
|
bind:value={searchFilter}
|
||||||
|
type="text"
|
||||||
|
class="input join-item"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="py-4"></div>
|
||||||
|
<div class="flex flex-wrap gap-2">
|
||||||
|
<div class="">Filter by region:</div>
|
||||||
|
{#each regionFilters as filter}
|
||||||
|
<div class="join">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
bind:checked={filter.selected}
|
||||||
|
class="join-item checkbox"
|
||||||
|
/>
|
||||||
|
<div class="input input-xs join-item">{filter.region}</div>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -165,23 +205,32 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each iso3 as country}
|
{#each iso3 as country}
|
||||||
|
{#if (getCountryName(country)
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(searchFilter.toLowerCase()) || country
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(searchFilter.toLowerCase())) && (!regionFilters.some((r) => r.selected) || regionFilters.find((r) => r.region === countryList.findByIso3(country)?.continent)?.selected)}
|
||||||
<tr>
|
<tr>
|
||||||
<th>{getCountryName(country)}</th>
|
<th>{getCountryName(country)}</th>
|
||||||
<th>{country}</th>
|
<th>{country}</th>
|
||||||
<th
|
<th>
|
||||||
><button
|
<div class="w-full h-full grid items-center justify-center">
|
||||||
|
<button
|
||||||
on:click={() => selectCountry(country, false)}
|
on:click={() => selectCountry(country, false)}
|
||||||
class="btn btn-outline btn-primary">From {country}</button
|
class="btn btn-outline btn-primary">From</button
|
||||||
></th
|
|
||||||
>
|
>
|
||||||
<th
|
</div>
|
||||||
><button
|
</th>
|
||||||
|
<th>
|
||||||
|
<div class="w-full h-full grid items-center justify-center">
|
||||||
|
<button
|
||||||
on:click={() => selectCountry(country, true)}
|
on:click={() => selectCountry(country, true)}
|
||||||
class="btn btn-outline btn-secondary"
|
class="btn btn-outline btn-secondary">Towards</button
|
||||||
>Towards {country}</button
|
|
||||||
></th
|
|
||||||
>
|
>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue