feat(components): implement Flag
This commit is contained in:
parent
f6bd3e8ab7
commit
a2180bed42
22
src/components/design/Flag/Flag.tsx
Normal file
22
src/components/design/Flag/Flag.tsx
Normal 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>}
|
||||
</>
|
||||
)
|
||||
}
|
1
src/components/design/Flag/index.ts
Normal file
1
src/components/design/Flag/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './Flag'
|
Loading…
Reference in New Issue
Block a user