mirror of
https://github.com/uetchy/namae.git
synced 2025-08-21 10:18:12 +09:00
feat: app store
This commit is contained in:
36
web/src/components/cards/AppStoreCard.js
Normal file
36
web/src/components/cards/AppStoreCard.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import React from 'react'
|
||||
import useFetch from 'fetch-suspense'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { FaAppStore } from 'react-icons/fa'
|
||||
|
||||
import { Card, Result } from '../Cards'
|
||||
|
||||
function Search({ query }) {
|
||||
const term = encodeURIComponent(query)
|
||||
const response = useFetch(`/availability/appstore/${term}`)
|
||||
const apps = response.result
|
||||
|
||||
return (
|
||||
<div>
|
||||
{apps.map((app) => (
|
||||
<Result
|
||||
title={app.name}
|
||||
message={`Price: ${app.price}`}
|
||||
link={app.viewURL}
|
||||
icon={<FaAppStore />}
|
||||
key={app.id}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default function AppStoreCard({ query }) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<Card title={t('providers.appStore')}>
|
||||
<Search query={query} />
|
||||
</Card>
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user