2020-08-31 08:41:53 +09:00
|
|
|
import React from 'react';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { IoIosBeer } from 'react-icons/io';
|
2019-08-06 00:45:18 +09:00
|
|
|
|
2020-08-31 08:41:53 +09:00
|
|
|
import { Card, Repeater, ExistentialAvailability } from '../core';
|
2019-07-31 13:11:00 +09:00
|
|
|
|
2020-08-20 00:57:33 +09:00
|
|
|
const HomebrewCard: React.FC<{ query: string }> = ({ query }) => {
|
2020-08-31 08:41:53 +09:00
|
|
|
const { t } = useTranslation();
|
|
|
|
const lowerCase = query.toLowerCase();
|
2019-07-31 13:11:00 +09:00
|
|
|
|
2020-08-31 08:41:53 +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.homebrew')}>
|
|
|
|
<Repeater items={names}>
|
|
|
|
{(name) => (
|
|
|
|
<>
|
|
|
|
<ExistentialAvailability
|
|
|
|
name={name}
|
|
|
|
target={`https://formulae.brew.sh/api/formula/${name}.json`}
|
2020-02-08 13:47:55 +09:00
|
|
|
message="Go to formula page"
|
|
|
|
link={`https://formulae.brew.sh/formula/${name}`}
|
2019-08-06 00:45:18 +09:00
|
|
|
icon={<IoIosBeer />}
|
|
|
|
/>
|
|
|
|
<ExistentialAvailability
|
|
|
|
name={name}
|
|
|
|
target={`https://formulae.brew.sh/api/cask/${name}.json`}
|
2020-02-08 13:47:55 +09:00
|
|
|
message="Go to formula page"
|
|
|
|
link={`https://formulae.brew.sh/cask/${name}`}
|
2019-08-06 00:45:18 +09:00
|
|
|
suffix=" (Cask)"
|
|
|
|
icon={<IoIosBeer />}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</Repeater>
|
2019-07-31 13:11:00 +09:00
|
|
|
</Card>
|
2020-08-31 08:41:53 +09:00
|
|
|
);
|
|
|
|
};
|
2019-09-01 01:28:24 +09:00
|
|
|
|
2020-08-31 08:41:53 +09:00
|
|
|
export default HomebrewCard;
|