2019-09-17 14:30:26 +09:00
|
|
|
import React from 'react';
|
|
|
|
import {useTranslation} from 'react-i18next';
|
2020-02-06 13:16:30 +09:00
|
|
|
import {MdDomain} from 'react-icons/md';
|
2019-08-06 00:45:18 +09:00
|
|
|
|
2020-02-05 16:22:35 +09:00
|
|
|
import {Card, Repeater, DedicatedAvailability} from '../core';
|
2020-02-08 18:10:45 +09:00
|
|
|
import {zones} from '../../../util/zones';
|
2019-07-31 13:11:00 +09:00
|
|
|
|
2019-09-17 14:30:26 +09:00
|
|
|
const DomainCard: React.FC<{query: string}> = ({query}) => {
|
|
|
|
const {t} = useTranslation();
|
|
|
|
const lowerCase = query.toLowerCase();
|
2019-07-31 13:11:00 +09:00
|
|
|
|
2020-02-08 18:10:45 +09:00
|
|
|
const domainHackSuggestions = zones
|
2020-02-09 09:07:28 +09:00
|
|
|
.map((zone) => new RegExp(`${zone}$`).exec(lowerCase.slice(1)))
|
2020-02-08 18:10:45 +09:00
|
|
|
.filter((s): s is RegExpExecArray => s !== null)
|
2020-02-08 19:00:01 +09:00
|
|
|
.map(
|
|
|
|
(m) =>
|
2020-02-09 09:07:28 +09:00
|
|
|
lowerCase.substring(0, m.index + 1) +
|
|
|
|
'.' +
|
|
|
|
lowerCase.substring(m.index + 1),
|
2020-02-08 19:00:01 +09:00
|
|
|
);
|
2020-02-08 18:10:45 +09:00
|
|
|
|
|
|
|
const names = [
|
|
|
|
`${lowerCase}.com`,
|
|
|
|
`${lowerCase}.io`,
|
|
|
|
`${lowerCase}.app`,
|
|
|
|
...domainHackSuggestions,
|
|
|
|
];
|
2019-08-06 00:45:18 +09:00
|
|
|
const moreNames = [
|
2020-02-05 20:21:14 +09:00
|
|
|
`${lowerCase}.org`,
|
2020-02-08 13:47:55 +09:00
|
|
|
`${lowerCase}.dev`,
|
|
|
|
`${lowerCase}.sh`,
|
|
|
|
`${lowerCase}.pro`,
|
2019-08-06 00:45:18 +09:00
|
|
|
`${lowerCase}.tools`,
|
2020-02-08 13:47:55 +09:00
|
|
|
`${lowerCase}.site`,
|
|
|
|
`${lowerCase}app.com`,
|
|
|
|
`get${lowerCase}.com`,
|
2019-09-17 14:30:26 +09:00
|
|
|
];
|
2019-08-06 00:45:18 +09:00
|
|
|
|
2019-07-31 13:11:00 +09:00
|
|
|
return (
|
2019-08-06 00:45:18 +09:00
|
|
|
<Card title={t('providers.domains')}>
|
|
|
|
<Repeater items={names} moreItems={moreNames}>
|
|
|
|
{(name) => (
|
|
|
|
<DedicatedAvailability
|
|
|
|
name={name}
|
2019-08-07 22:25:51 +09:00
|
|
|
message="Go to Domainr.com"
|
2019-08-06 00:45:18 +09:00
|
|
|
service="domain"
|
|
|
|
link={`https://domainr.com/?q=${name}`}
|
2020-02-06 13:16:30 +09:00
|
|
|
icon={<MdDomain />}
|
2019-08-06 00:45:18 +09:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</Repeater>
|
2019-07-31 13:11:00 +09:00
|
|
|
</Card>
|
2019-09-17 14:30:26 +09:00
|
|
|
);
|
|
|
|
};
|
2019-09-01 01:28:24 +09:00
|
|
|
|
2019-09-17 14:30:26 +09:00
|
|
|
export default DomainCard;
|