feat(components): implement Flag

This commit is contained in:
Walid 2023-05-04 16:12:13 +01:00
parent f6bd3e8ab7
commit a2180bed42
Signed by: Walidoux
GPG Key ID: CCF21881FE8BEBAF
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,22 @@
import classNames from 'classnames'
import type { Component } from 'solid-js'
import { SUPPORTED_LANGS } from '../../../config'
interface FlagProps {
label?: boolean
domain: string
}
export const Flag: Component<FlagProps> = (props) => {
const lang = SUPPORTED_LANGS.filter((lang) => {
return lang.domain === props.domain
})[0]
return (
<>
<span class={classNames('', `fi fi-${lang.code}`)} />
{Boolean(props.label) && <span class='ml-3'>{lang.name}</span>}
</>
)
}

View File

@ -0,0 +1 @@
export * from './Flag'