2019-09-17 14:30:26 +09:00
|
|
|
import React from 'react';
|
|
|
|
import {useTranslation} from 'react-i18next';
|
|
|
|
import {FaTwitter} from 'react-icons/fa';
|
2019-08-06 00:45:18 +09:00
|
|
|
|
2020-02-05 16:22:35 +09:00
|
|
|
import {capitalize} from '../../../util/text';
|
|
|
|
import {Card, Repeater, DedicatedAvailability} from '../core';
|
2019-07-31 13:11:00 +09:00
|
|
|
|
2019-09-17 14:30:26 +09:00
|
|
|
const TwitterCard: React.FC<{query: string}> = ({query}) => {
|
|
|
|
const {t} = useTranslation();
|
2019-08-03 13:36:29 +09:00
|
|
|
|
2020-06-11 21:59:58 +09:00
|
|
|
const sanitizedQuery = query
|
|
|
|
.replace(/[^0-9a-zA-Z_-]/g, '')
|
|
|
|
.replace(/-/g, '_');
|
|
|
|
const lowerCase = sanitizedQuery.toLowerCase();
|
|
|
|
const capitalCase = capitalize(sanitizedQuery);
|
|
|
|
|
|
|
|
const names = [sanitizedQuery, `${capitalCase}App`, `${lowerCase}hq`];
|
2019-08-06 00:45:18 +09:00
|
|
|
const moreNames = [
|
2019-08-06 02:07:05 +09:00
|
|
|
`hey${lowerCase}`,
|
|
|
|
`${capitalCase}Team`,
|
2020-06-11 21:59:58 +09:00
|
|
|
`${lowerCase}_support`,
|
2020-02-05 20:21:14 +09:00
|
|
|
`${lowerCase}_org`,
|
2020-06-11 21:59:58 +09:00
|
|
|
`${lowerCase}_app`,
|
2020-02-05 20:21:14 +09:00
|
|
|
`${capitalCase}JS`,
|
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.twitter')}>
|
|
|
|
<Repeater items={names} moreItems={moreNames}>
|
|
|
|
{(name) => (
|
|
|
|
<DedicatedAvailability
|
|
|
|
name={name}
|
2020-06-11 21:59:58 +09:00
|
|
|
query={name}
|
|
|
|
service="twitter"
|
2019-08-07 22:25:51 +09:00
|
|
|
message="Go to Twitter"
|
2019-08-06 00:45:18 +09:00
|
|
|
link={`https://twitter.com/${name}`}
|
|
|
|
icon={<FaTwitter />}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</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 TwitterCard;
|