domain-watchdog/assets/pages/DomainFinderPage.tsx

62 lines
2.6 KiB
TypeScript
Raw Normal View History

2024-07-25 02:09:49 +02:00
import React, {ChangeEvent, useState} from 'react';
2024-07-23 21:57:23 +02:00
import Container from "@mui/material/Container";
2024-07-25 02:09:49 +02:00
import {Grid, InputAdornment, Paper} from "@mui/material";
import TextField from "@mui/material/TextField";
import Typography from "@mui/material/Typography";
import {Explore} from "@mui/icons-material";
import Footer from "../components/Footer";
2024-07-23 18:37:59 +02:00
2024-07-25 02:09:49 +02:00
export default function DomainFinderPage() {
const [ldhName, setLdhName] = useState("")
const [error, setError] = useState(false)
const onChangeDomain = (e: ChangeEvent<HTMLInputElement>) => {
setLdhName(e.currentTarget.value);
const regex = /^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$/
setError(!regex.test(e.currentTarget.value))
}
2024-07-23 18:37:59 +02:00
return (
<>
2024-07-25 02:09:49 +02:00
<Container maxWidth="lg" sx={{mt: 20, mb: 4}}>
2024-07-23 21:57:23 +02:00
<Grid container spacing={3}>
<Grid item xs={12} md={8} lg={9}>
<Paper
sx={{
p: 2,
display: 'flex',
flexDirection: 'column',
height: 240,
}}
>
2024-07-25 02:09:49 +02:00
<TextField
sx={{mt: 5}} label="Domain name" variant="standard" value={ldhName}
onChange={onChangeDomain}
helperText={error && "This domain name does not appear to be valid"}
error={error}
InputProps={{
startAdornment: (
<InputAdornment position="start">
<Explore/>
</InputAdornment>
),
}}
/>
2024-07-24 13:46:10 +02:00
2024-07-25 02:09:49 +02:00
<Typography variant="subtitle2" sx={{mt: 3}}>
This tool allows you to search for a domain name in the database.
As a reminder, if a domain name is unknown to Domain Watchdog or if the data is
more
than a week old, an RDAP search will be performed. The RDAP search is an operation worth
a token.
</Typography>
2024-07-23 21:57:23 +02:00
</Paper>
</Grid>
</Grid>
2024-07-25 02:09:49 +02:00
<Footer/>
2024-07-23 21:57:23 +02:00
</Container>
2024-07-23 18:37:59 +02:00
</>
);
};