2024-12-30 23:50:15 +01:00
|
|
|
import {Form, Input} from 'antd'
|
|
|
|
|
import {t} from 'ttag'
|
|
|
|
|
import {SearchOutlined} from '@ant-design/icons'
|
|
|
|
|
import React from 'react'
|
2024-07-29 18:41:36 +02:00
|
|
|
|
2024-12-30 23:50:15 +01:00
|
|
|
export interface FieldType {
|
2024-07-29 18:41:36 +02:00
|
|
|
ldhName: string
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-30 23:50:15 +01:00
|
|
|
export function DomainSearchBar({onFinish, initialValue}: {
|
|
|
|
|
onFinish: (values: FieldType) => void,
|
|
|
|
|
initialValue?: string
|
|
|
|
|
}) {
|
|
|
|
|
return (
|
|
|
|
|
<Form
|
|
|
|
|
onFinish={onFinish}
|
|
|
|
|
autoComplete='off'
|
|
|
|
|
style={{width: '100%'}}
|
2024-07-29 18:41:36 +02:00
|
|
|
>
|
2024-12-30 23:50:15 +01:00
|
|
|
<Form.Item<FieldType>
|
|
|
|
|
name='ldhName'
|
|
|
|
|
initialValue={initialValue}
|
|
|
|
|
rules={[{
|
|
|
|
|
required: true,
|
|
|
|
|
message: t`Required`
|
|
|
|
|
}, {
|
|
|
|
|
pattern: /^(?=.*\.)?\S*[^.\s]$/,
|
|
|
|
|
message: t`This domain name does not appear to be valid`,
|
|
|
|
|
max: 63,
|
|
|
|
|
min: 2
|
|
|
|
|
}]}
|
|
|
|
|
>
|
|
|
|
|
<Input
|
|
|
|
|
style={{textAlign: 'center'}}
|
|
|
|
|
size='large'
|
|
|
|
|
prefix={<SearchOutlined/>}
|
|
|
|
|
placeholder='example.com'
|
|
|
|
|
autoComplete='off'
|
|
|
|
|
autoFocus
|
|
|
|
|
/>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
|
)
|
|
|
|
|
}
|