2019-09-17 14:30:26 +09:00
|
|
|
import React from 'react';
|
|
|
|
import {useTranslation} from 'react-i18next';
|
|
|
|
import {FaNpm} 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 NpmCard: React.FC<{query: string}> = ({query}) => {
|
|
|
|
const {t} = useTranslation();
|
|
|
|
const lowerCase = query.toLowerCase();
|
2019-07-31 13:11:00 +09:00
|
|
|
|
2019-09-17 14:30:26 +09:00
|
|
|
const names = [lowerCase];
|
|
|
|
const moreNames = [`${lowerCase}-js`];
|
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.npm')}>
|
|
|
|
<Repeater items={names} moreItems={moreNames}>
|
|
|
|
{(name) => (
|
|
|
|
<>
|
|
|
|
<DedicatedAvailability
|
|
|
|
name={name}
|
|
|
|
service="npm"
|
2019-08-07 22:25:51 +09:00
|
|
|
message="Read publishing guide"
|
|
|
|
link="https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry"
|
|
|
|
messageIfTaken={`See ${name}`}
|
|
|
|
linkIfTaken={`https://www.npmjs.com/package/${name}`}
|
2019-08-06 00:45:18 +09:00
|
|
|
icon={<FaNpm />}
|
|
|
|
/>
|
|
|
|
<DedicatedAvailability
|
|
|
|
name={name}
|
|
|
|
service="npm-org"
|
2019-08-07 22:25:51 +09:00
|
|
|
message="Create Org"
|
|
|
|
link="https://www.npmjs.com/org/create"
|
|
|
|
messageIfTaken={`See @${name}`}
|
|
|
|
linkIfTaken={`https://www.npmjs.com/org/${name}`}
|
2019-08-06 00:45:18 +09:00
|
|
|
prefix="@"
|
|
|
|
suffix=" (Organization)"
|
|
|
|
icon={<FaNpm />}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</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 NpmCard;
|