shared: add independent IPv4 and IPv6 collection [CI]
This commit is contained in:
1 parent
c974a7dddb
commit
0eda0600cc
60 files changed
+699
-137
No files matched your search
@@ -0,0 +1,10 @@
|
||||
import { Segmented } from './ui'
|
||||
|
||||
export type IpVersion = 'ipv4' | 'ipv6'
|
||||
export const ipVersionOf = (value: string | null | undefined): IpVersion => value === 'ipv6' ? 'ipv6' : 'ipv4'
|
||||
export const IP_VERSIONS: { value: IpVersion; label: string }[] = [{ value: 'ipv4', label: 'IPv4' }, { value: 'ipv6', label: 'IPv6' }]
|
||||
export const lineIdFor = (id: string, version: IpVersion): string => id.replace(/~ipv6$/, '') + (version === 'ipv6' ? '~ipv6' : '')
|
||||
|
||||
export function IpVersionPicker({ value, onChange }: { value: IpVersion; onChange: (value: IpVersion) => void }) {
|
||||
return <Segmented options={IP_VERSIONS} value={value} onChange={onChange} />
|
||||
}
|
||||
Reference in new issue
Block a user