1
0
mirror of https://github.com/uetchy/namae.git synced 2025-07-05 15:50:03 +09:00

35 lines
979 B
TypeScript
Raw Normal View History

2020-02-05 16:22:35 +09:00
import React from 'react';
import {useTranslation} from 'react-i18next';
import {FaPython} 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, DedicatedAvailability, Repeater} from '../core';
2019-07-31 13:11:00 +09:00
2020-02-05 16:22:35 +09:00
const PypiCard: React.FC<{query: string}> = ({query}) => {
const {t} = useTranslation();
2019-08-03 13:36:29 +09:00
2020-02-05 16:22:35 +09:00
const names = [query];
const moreNames = [`Py${capitalize(query)}`];
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.pypi')}>
<Repeater items={names} moreItems={moreNames}>
{(name) => (
<DedicatedAvailability
name={name}
2019-08-27 03:15:35 +09:00
query={`pypi.org/pypi/${name}/json`}
service="existence"
2019-08-07 22:25:51 +09:00
message="Read Python Packaging User Guide"
link="https://packaging.python.org/"
messageIfTaken="Go to PyPI"
linkIfTaken={`https://pypi.org/project/${name}`}
2019-08-06 00:45:18 +09:00
icon={<FaPython />}
/>
)}
</Repeater>
2019-07-31 13:11:00 +09:00
</Card>
2020-02-05 16:22:35 +09:00
);
};
2019-09-01 01:28:24 +09:00
2020-02-05 16:22:35 +09:00
export default PypiCard;