1
0
mirror of https://github.com/uetchy/namae.git synced 2025-08-20 18:08:11 +09:00
Files
namae/src/components/cards/providers/JsOrg.tsx

37 lines
969 B
TypeScript
Raw Normal View History

2019-09-17 14:30:26 +09:00
import React from 'react';
import {useTranslation} from 'react-i18next';
import {FaJsSquare} from 'react-icons/fa';
2019-08-06 00:45:18 +09:00
2020-02-05 16:22:35 +09:00
import {Card, Repeater, DedicatedAvailability} from '../core';
2019-07-31 13:11:00 +09:00
2019-09-17 14:30:26 +09:00
const JsOrgCard: React.FC<{query: string}> = ({query}) => {
const {t} = useTranslation();
2020-06-11 22:00:16 +09:00
const sanitizedQuery = query
.replace(/[^0-9a-zA-Z_-]/g, '')
.replace(/_/g, '-');
const lowerCase = sanitizedQuery.toLowerCase();
2019-07-31 13:11:00 +09:00
2019-09-17 14:30:26 +09:00
const names = [lowerCase];
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.jsorg')}>
<Repeater items={names}>
{(name) => (
<DedicatedAvailability
name={`${name}.js.org`}
service="dns"
2019-08-07 22:25:51 +09:00
message="Go to js.org repository"
link="https://github.com/js-org/js.org"
messageIfTaken={`Go to ${name}.js.org`}
linkIfTaken={`https://${name}.js.org`}
2019-08-06 00:45:18 +09:00
icon={<FaJsSquare />}
/>
)}
</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 JsOrgCard;