1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-23 14:59:36 +02:00

Update getFlag function to accept size parameter

This commit is contained in:
Sean Morley 2024-04-13 20:39:06 +00:00
parent 02455d290b
commit 8a169da9e2
3 changed files with 10 additions and 4 deletions

View file

@ -34,8 +34,14 @@ export function countryCodeToName(countryCode: string) {
}
}
export function getFlag(country: string) {
return `https://flagcdn.com/h24/${country}.png`;
/**
* Generates the URL for a flag image based on the specified size and country code.
* @param size - The desired height of the flag image. Avaliable sizes: 20, 24, 40, 60, 80, 120, 240.
* @param country - The 2 digit country code representing the desired flag.
* @returns The URL of the flag image.
*/
export function getFlag(size:number,country: string) {
return `https://flagcdn.com/h${size}/${country}.png`;
}
export function generateRandomString() {