Skip to content

Commit

Permalink
vue stylesheetprops
Browse files Browse the repository at this point in the history
  • Loading branch information
eddow committed Jun 8, 2024
1 parent 5aa824d commit 8c66e7d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/tools/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@ import { Locale } from '../types'
export const flagEmojiExceptions: Record<string, string> = { en: '🇬🇧' }
export const flagClassExceptions: Record<string, string> = { en: 'gb' }

const styleSheet = `\n<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/7.2.3/css/flag-icons.min.css" integrity="sha512-bZBu2H0+FGFz/stDN/L0k8J0G8qVsAL0ht1qg5kTwtAheiXwiRKyCq1frwfbSFSJN3jooR5kauE0YjtPzhZtJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />`
const styleSheet = `\n<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/7.2.3/css/flag-icons.min.css" integrity="sha512-bZBu2H0+FGFz/stDN/L0k8J0G8qVsAL0ht1qg5kTwtAheiXwiRKyCq1frwfbSFSJN3jooR5kauE0YjtPzhZtJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />`,
styleSheetProps = {
rel: 'stylesheet',
href: 'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/7.2.3/css/flag-icons.min.css',
integrity:
'sha512-bZBu2H0+FGFz/stDN/L0k8J0G8qVsAL0ht1qg5kTwtAheiXwiRKyCq1frwfbSFSJN3jooR5kauE0YjtPzhZtJQ==',
crossorigin: 'anonymous',
referrerpolicy: 'no-referrer'
}

export let flagEngine: 'emojis' | 'flag-icons'
export let headStyle: string = ''

export interface LocaleFlagsEngine {
(locale: Locale): string[]
headerContent?: string
styleSheetProps?: any
}

const engines: Record<'emojis' | 'flag-icons', LocaleFlagsEngine> = {
Expand Down Expand Up @@ -43,6 +52,7 @@ const engines: Record<'emojis' | 'flag-icons', LocaleFlagsEngine> = {
}
}
engines['flag-icons'].headerContent = styleSheet
engines['flag-icons'].styleSheetProps = styleSheetProps
engines.emojis.headerContent = ''

export function localeFlagsEngine(
Expand Down

0 comments on commit 8c66e7d

Please sign in to comment.