1
0
mirror of https://github.com/uetchy/namae.git synced 2025-07-02 06:20:02 +09:00
namae/src/components/Welcome.tsx

208 lines
3.9 KiB
TypeScript
Raw Normal View History

2020-08-20 00:57:33 +09:00
import React from 'react'
import styled from 'styled-components'
import { useTranslation } from 'react-i18next'
import { Link } from 'react-router-dom'
2019-08-01 13:21:23 +09:00
2019-08-07 14:16:06 +09:00
import {
FaMapSigns,
FaGithub,
2019-10-16 14:14:02 +09:00
FaGitlab,
2019-08-07 14:16:06 +09:00
FaNpm,
FaPython,
FaGem,
FaLinux,
FaAppStore,
2020-03-20 11:33:01 +01:00
FaInstagram,
2019-08-07 14:16:06 +09:00
FaTwitter,
FaSlack,
FaAws,
FaJsSquare,
2019-09-01 00:00:24 +09:00
FaBuilding,
2020-08-20 00:57:33 +09:00
} from 'react-icons/fa'
import { IoIosBeer } from 'react-icons/io'
import { DiRust, DiHeroku, DiFirebase } from 'react-icons/di'
2019-08-01 13:21:23 +09:00
2020-08-20 00:57:33 +09:00
import { SpectrumIcon, NowIcon, NetlifyIcon, OcamlIcon } from './Icons'
import { mobile } from '../util/css'
import { sendGettingStartedEvent } from '../util/analytics'
2019-08-01 13:21:23 +09:00
2020-06-20 18:19:05 +09:00
const supportedProviders: Record<string, React.ReactNode> = {
domains: <FaMapSigns />,
github: <FaGithub />,
gitlab: <FaGitlab />,
npm: <FaNpm />,
rust: <DiRust />,
pypi: <FaPython />,
rubygems: <FaGem />,
ocaml: <OcamlIcon />,
homebrew: <IoIosBeer />,
linux: <FaLinux />,
twitter: <FaTwitter />,
instagram: <FaInstagram />,
spectrum: <SpectrumIcon />,
slack: <FaSlack />,
heroku: <DiHeroku />,
now: <NowIcon />,
netlify: <NetlifyIcon />,
s3: <FaAws />,
firebase: <DiFirebase />,
jsorg: <FaJsSquare />,
githubSearch: <FaGithub />,
appStore: <FaAppStore />,
nta: <FaBuilding />,
2020-08-20 00:57:33 +09:00
}
2020-06-20 18:19:05 +09:00
2019-12-24 01:57:07 +09:00
const Welcome: React.FC = () => {
2020-08-20 00:57:33 +09:00
const { t } = useTranslation()
2019-08-03 13:36:29 +09:00
2019-08-01 13:21:23 +09:00
return (
<Container>
2020-07-29 14:02:27 +09:00
<Section>
2020-02-06 13:16:30 +09:00
<HeroTitle>{t('title')}</HeroTitle>
<HeroText>{t('description')}</HeroText>
<ButtonContainer>
2020-02-05 19:22:35 +09:00
<List>
2020-03-06 23:46:19 +09:00
<ListButton>
2020-07-29 13:44:03 +09:00
<Link to="/s/namae" onClick={() => sendGettingStartedEvent()}>
{t('gettingStartedWithExample')}
2020-03-06 23:46:19 +09:00
</Link>
</ListButton>
2020-02-05 19:22:35 +09:00
</List>
2020-02-06 13:16:30 +09:00
</ButtonContainer>
2020-07-29 14:02:27 +09:00
</Section>
<HighlightSection>
2020-06-20 18:19:05 +09:00
{Object.keys(supportedProviders).map((key) => (
<ListItem key={key}>
{supportedProviders[key]} {t(`providers.${key}`)}
</ListItem>
))}
2020-07-29 14:02:27 +09:00
</HighlightSection>
<Section>
<Title>Integrations</Title>
<blockquote>Soon</blockquote>
</Section>
2019-08-01 13:21:23 +09:00
</Container>
2020-08-20 00:57:33 +09:00
)
}
2020-07-29 14:02:27 +09:00
2020-08-20 00:57:33 +09:00
export default Welcome
2019-08-01 13:21:23 +09:00
const Container = styled.div`
2019-08-01 14:00:22 +09:00
padding-bottom: 40px;
2019-08-01 13:21:23 +09:00
text-align: center;
font-size: 1.5rem;
${mobile} {
2020-02-06 13:16:30 +09:00
margin-top: 0px;
2019-08-01 13:21:23 +09:00
text-align: left;
2020-07-29 14:02:27 +09:00
font-size: 1.1rem;
2019-08-01 13:21:23 +09:00
}
2020-08-20 00:57:33 +09:00
`
2019-08-01 13:21:23 +09:00
2020-07-29 14:02:27 +09:00
const Section = styled.div`
padding: 100px 20vw;
${mobile} {
padding: 60px 40px;
}
2020-08-20 00:57:33 +09:00
`
2020-07-29 14:02:27 +09:00
const HighlightSection = styled.div`
padding: 100px 20vw;
width: 100%;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
${mobile} {
flex-direction: column;
padding: 40px 40px 60px;
}
color: white;
/* background-image: linear-gradient(180deg, #a57bf3 0%, #4364e1 100%); */
background: #632bec;
2020-08-20 00:57:33 +09:00
`
2020-07-29 14:02:27 +09:00
const Title = styled.h1`
line-height: 1.6em;
2020-02-06 17:21:22 +09:00
font-size: 5rem;
2020-02-06 13:16:30 +09:00
font-weight: 700;
2019-08-03 13:36:29 +09:00
${mobile} {
2020-02-06 13:16:30 +09:00
font-size: 2.5em;
2019-08-03 13:36:29 +09:00
}
2020-08-20 00:57:33 +09:00
`
2019-08-01 14:00:22 +09:00
2020-07-29 14:02:27 +09:00
const HeroTitle = styled(Title)`
padding-bottom: 30px;
line-height: 1em;
2020-08-20 00:57:33 +09:00
`
2020-07-29 14:02:27 +09:00
2020-02-06 13:16:30 +09:00
const HeroText = styled.p`
2019-08-01 14:00:22 +09:00
font-size: 1.2em;
2020-03-06 23:46:19 +09:00
font-weight: 400;
2020-02-06 13:27:43 +09:00
line-height: 1.3em;
2019-08-01 14:00:22 +09:00
color: #3c3c3c;
2020-08-20 00:57:33 +09:00
`
2019-08-01 14:00:22 +09:00
2020-02-06 13:16:30 +09:00
const ButtonContainer = styled.div`
2020-03-06 23:46:19 +09:00
margin: 10px 0 0 0;
2020-08-20 00:57:33 +09:00
`
2020-02-05 19:22:35 +09:00
2019-08-01 13:21:23 +09:00
const List = styled.div`
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
2020-02-06 13:16:30 +09:00
2020-02-05 19:22:35 +09:00
font-size: 1rem;
${mobile} {
justify-content: flex-start;
}
2020-08-20 00:57:33 +09:00
`
2020-02-05 19:22:35 +09:00
2019-08-01 13:21:23 +09:00
const ListItem = styled.div`
2020-02-06 13:16:30 +09:00
margin: 20px 25px;
2019-08-01 13:21:23 +09:00
display: flex;
align-items: center;
2020-02-05 20:47:03 +09:00
font-size: 1.5rem;
2019-08-01 14:00:22 +09:00
line-height: 1em;
2019-08-01 13:21:23 +09:00
${mobile} {
margin: 10px 0;
2020-02-05 20:47:03 +09:00
font-size: 1.2rem;
2019-08-01 13:21:23 +09:00
}
svg {
margin-right: 5px;
}
2020-08-20 00:57:33 +09:00
`
2020-02-05 19:22:35 +09:00
const ListButton = styled.div`
2020-02-06 13:27:43 +09:00
margin: 10px 5px;
2020-02-05 19:22:35 +09:00
display: flex;
align-items: center;
font-size: 1.2rem;
line-height: 1em;
${mobile} {
margin: 10px 10px 0 0;
}
a {
color: black;
2020-03-06 23:46:19 +09:00
padding: 12px 25px;
2020-02-05 19:22:35 +09:00
border: 1px solid black;
border-radius: 2px;
2020-02-06 13:27:43 +09:00
text-decoration: none;
2020-02-06 03:39:06 +09:00
&:hover {
color: white;
background: black;
}
2020-02-05 19:22:35 +09:00
}
2020-08-20 00:57:33 +09:00
`