mirror of
https://github.com/uetchy/namae.git
synced 2025-08-20 09:58:13 +09:00
dev: initial attempt
This commit is contained in:
37
components/cards/providers/YouTube.tsx
Normal file
37
components/cards/providers/YouTube.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { FaYoutube } from 'react-icons/fa';
|
||||
import { normalize } from '../../../util/text';
|
||||
|
||||
import { Card, Repeater, DedicatedAvailability } from '../core';
|
||||
|
||||
const YouTubeCard: React.FC<{ query: string }> = ({ query }) => {
|
||||
const { t } = useTranslation();
|
||||
const normalizedQuery = normalize(query, {
|
||||
alphanumeric: false,
|
||||
allowUnderscore: false,
|
||||
allowHyphens: false,
|
||||
});
|
||||
const lowerCase = normalizedQuery.toLowerCase();
|
||||
|
||||
const names = [normalizedQuery];
|
||||
const moreNames = [`${lowerCase}app`, `${lowerCase}team`, `${lowerCase}hq`];
|
||||
|
||||
return (
|
||||
<Card title={t('providers.youtube')}>
|
||||
<Repeater items={names} moreItems={moreNames}>
|
||||
{(name) => (
|
||||
<DedicatedAvailability
|
||||
name={`youtube.com/c/${name}`}
|
||||
service="existence"
|
||||
message={`Go to youtube.com/c/${name}`}
|
||||
link={`https://www.youtube.com/c/${name}`}
|
||||
icon={<FaYoutube />}
|
||||
/>
|
||||
)}
|
||||
</Repeater>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default YouTubeCard;
|
Reference in New Issue
Block a user