mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-03 20:25:18 +02:00
Add continent code to the country cards
This commit is contained in:
parent
bdb37c5ca1
commit
2d7fe56086
3 changed files with 106 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { getFlag } from '$lib';
|
||||
import { continentCodeToString, getFlag } from '$lib';
|
||||
import type { Country } from '$lib/types';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
const dispatch = createEventDispatcher();
|
||||
|
@ -21,6 +21,7 @@
|
|||
</figure>
|
||||
<div class="card-body">
|
||||
<h2 class="card-title overflow-ellipsis">{country.name}</h2>
|
||||
<div class="badge badge-primary">{continentCodeToString(country.continent)}</div>
|
||||
<div class="card-actions justify-end">
|
||||
<!-- <button class="btn btn-info" on:click={moreInfo}>More Info</button> -->
|
||||
<button class="btn btn-primary" on:click={nav}>Open</button>
|
||||
|
|
|
@ -177,3 +177,24 @@ export function groupChecklistsByDate(
|
|||
|
||||
return groupedChecklists;
|
||||
}
|
||||
|
||||
export function continentCodeToString(code: string) {
|
||||
switch (code) {
|
||||
case 'AF':
|
||||
return 'Africa';
|
||||
case 'AN':
|
||||
return 'Antarctica';
|
||||
case 'AS':
|
||||
return 'Asia';
|
||||
case 'EU':
|
||||
return 'Europe';
|
||||
case 'NA':
|
||||
return 'North America';
|
||||
case 'OC':
|
||||
return 'Oceania';
|
||||
case 'SA':
|
||||
return 'South America';
|
||||
default:
|
||||
return 'Unknown';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue