1
0
mirror of https://github.com/uetchy/namae.git synced 2025-03-16 20:20:38 +09:00

Merge pull request #162 from Snazzah/feature/hexpm

feat: add Hex.pm card
This commit is contained in:
uetchy 2022-06-03 21:21:24 +09:00 committed by GitHub
commit 36b77ed657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 2 deletions

View File

@ -48,7 +48,8 @@
"cloudflare": "Cloudflare Pages",
"chromeWebStore": "Chrome Web Store",
"firefoxAddons": "Firefox Add-ons",
"youtube": "YouTube"
"youtube": "YouTube",
"hexpm": "Hex"
},
"showMore": "show more",
"try": "How about this?",

View File

@ -19,7 +19,7 @@ import {
import { IoIosBeer, IoMdAppstore } from 'react-icons/io';
import { MdDomain } from 'react-icons/md';
import { RiBuilding2Fill, RiChromeFill, RiNpmjsFill } from 'react-icons/ri';
import { SiDeno } from 'react-icons/si';
import { SiDeno, SiElixir } from 'react-icons/si';
import {
SiAppstore,
SiArchlinux,
@ -46,6 +46,7 @@ const supportedProviders: Record<string, React.ReactNode> = {
rust: <SiRust />,
pypi: <FaPython />,
rubygems: <SiRubygems />,
hexpm: <SiElixir />,
ocaml: <OcamlIcon />,
archlinux: <SiArchlinux />,
ubuntu: <SiUbuntu />,

View File

@ -13,6 +13,7 @@ import GithubCard from './providers/GitHubOrganization';
import GithubSearchCard from './providers/GitHubSearch';
import GitLabCard from './providers/GitLab';
import HerokuCard from './providers/Heroku';
import HexPmCard from './providers/HexPm';
import HomebrewCard from './providers/Homebrew';
// import InstagramCard from './providers/Instagram';
import JsOrgCard from './providers/JsOrg';
@ -50,6 +51,7 @@ const Index: React.FC<{ query: string }> = ({ query }) => {
<PypiCard query={query} />
<CratesioCard query={query} />
<RubyGemsCard query={query} />
<HexPmCard query={query} />
<LinuxCard query={query} />
<OcamlCard query={query} />
<VercelCard query={query} />

View File

@ -0,0 +1,32 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { SiElixir } from 'react-icons/si';
import { normalize } from '../../../util/text';
import { Card, DedicatedAvailability, Repeater } from '../core';
const HexPmCard: React.FC<{ query: string }> = ({ query }) => {
const { t } = useTranslation();
const normalizedQuery = normalize(query);
const lowerCase = normalizedQuery.toLowerCase();
const names = [normalizedQuery];
const moreNames = [`${lowerCase}-ex`];
return (
<Card title={t('providers.hexpm')}>
<Repeater items={names} moreItems={moreNames}>
{(name) => (
<DedicatedAvailability
name={name}
query={`hex.pm/packages/${name}`}
service="existence"
message="Go to Hex"
link={`https://hex.pm/packages/${name}`}
icon={<SiElixir />}
/>
)}
</Repeater>
</Card>
);
};
export default HexPmCard;