Update AdventureCard component and add country flag support
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
|
||||
export let type: String;
|
||||
|
||||
export let name: String;
|
||||
export let location: String;
|
||||
export let created: string;
|
||||
export let id: Number;
|
||||
export let name: String | undefined = undefined;
|
||||
export let location: String | undefined = undefined;
|
||||
export let created: String | undefined = undefined;
|
||||
export let id: Number | undefined = undefined;
|
||||
|
||||
function remove() {
|
||||
dispatch("remove", id);
|
||||
@@ -103,3 +103,16 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if type === "worldtravelregion"}
|
||||
<div
|
||||
class="card min-w-max lg:w-96 md:w-80 sm:w-60 xs:w-40 bg-neutral shadow-xl overflow-hidden"
|
||||
>
|
||||
<div class="card-body">
|
||||
<h2 class="card-title overflow-ellipsis">{name}</h2>
|
||||
<div class="card-actions justify-end">
|
||||
<button class="btn btn-primary">Mark Visited</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,4 +1,43 @@
|
||||
// place files you want to import through the `$lib` alias in this folder.
|
||||
export function countryCodeToName(countryCode: string) {
|
||||
switch (countryCode) {
|
||||
case "us":
|
||||
return "United States";
|
||||
case "de":
|
||||
return "Germany";
|
||||
case "fr":
|
||||
return "France";
|
||||
case "gb":
|
||||
return "United Kingdom";
|
||||
case "ar":
|
||||
return "Argentina";
|
||||
case "mx":
|
||||
return "Mexico";
|
||||
case "jp":
|
||||
return "Japan";
|
||||
case "cn":
|
||||
return "China";
|
||||
case "in":
|
||||
return "India";
|
||||
case "au":
|
||||
return "Australia";
|
||||
case "nz":
|
||||
return "New Zealand";
|
||||
case "za":
|
||||
return "South Africa";
|
||||
case "eg":
|
||||
return "Egypt";
|
||||
case "ca":
|
||||
return "Canada";
|
||||
case "br":
|
||||
return "Brazil";
|
||||
}
|
||||
}
|
||||
|
||||
export function getFlag(country: string) {
|
||||
return `https://flagcdn.com/h24/${country}.png`;
|
||||
}
|
||||
|
||||
export function generateRandomString() {
|
||||
let randomString = "";
|
||||
const digits =
|
||||
|
||||
Reference in New Issue
Block a user