2020-08-20 00:57:33 +09:00
|
|
|
import React from 'react'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { NetlifyIcon } from '../../Icons'
|
2019-10-16 14:14:02 +09:00
|
|
|
|
2020-08-20 00:57:33 +09:00
|
|
|
import { Card, Repeater, DedicatedAvailability } from '../core'
|
2019-10-16 14:14:02 +09:00
|
|
|
|
2020-08-20 00:57:33 +09:00
|
|
|
const NetlifyCard: React.FC<{ query: string }> = ({ query }) => {
|
|
|
|
const { t } = useTranslation()
|
2020-06-11 22:00:16 +09:00
|
|
|
|
2020-08-20 00:57:33 +09:00
|
|
|
const sanitizedQuery = query.replace(/[^0-9a-zA-Z_-]/g, '').replace(/_/g, '-')
|
|
|
|
const lowerCase = sanitizedQuery.toLowerCase()
|
2019-10-16 14:14:02 +09:00
|
|
|
|
2020-08-20 00:57:33 +09:00
|
|
|
const names = [lowerCase]
|
2019-10-16 14:14:02 +09:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Card title={t('providers.netlify')}>
|
|
|
|
<Repeater items={names}>
|
|
|
|
{(name) => (
|
|
|
|
<DedicatedAvailability
|
|
|
|
name={`${name}.netlify.com`}
|
|
|
|
service="existence"
|
|
|
|
message={`Open ${name}.netlify.com`}
|
|
|
|
link={`https://${name}.netlify.com`}
|
|
|
|
icon={<NetlifyIcon />}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</Repeater>
|
|
|
|
</Card>
|
2020-08-20 00:57:33 +09:00
|
|
|
)
|
|
|
|
}
|
2019-10-16 14:14:02 +09:00
|
|
|
|
2020-08-20 00:57:33 +09:00
|
|
|
export default NetlifyCard
|