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

206 lines
4.1 KiB
TypeScript
Raw Normal View History

2020-08-31 08:41:53 +09:00
import React from 'react';
import { useTranslation } from 'react-i18next';
2020-08-31 09:57:18 +09:00
import { DiHeroku } from 'react-icons/di';
2019-08-07 14:16:06 +09:00
import {
2020-08-31 09:57:18 +09:00
FaAws,
2019-08-07 14:16:06 +09:00
FaGithub,
2020-08-31 09:57:18 +09:00
FaGithubAlt,
2019-10-16 14:14:02 +09:00
FaGitlab,
2020-03-20 11:33:01 +01:00
FaInstagram,
2019-08-07 14:16:06 +09:00
FaJsSquare,
2020-08-31 09:57:18 +09:00
FaLinux,
FaPython,
FaSlack,
FaTwitter,
2020-08-31 08:41:53 +09:00
} from 'react-icons/fa';
2020-08-31 09:57:18 +09:00
import { IoIosBeer, IoMdAppstore } from 'react-icons/io';
import { MdDomain } from 'react-icons/md';
import { RiBuilding2Fill, RiNpmjsFill } from 'react-icons/ri';
import { SiAppstore, SiFirebase, SiRubygems, SiRust } from 'react-icons/si';
import { Link } from 'react-router-dom';
import styled from 'styled-components';
2020-08-31 08:41:53 +09:00
import { sendGettingStartedEvent } from '../util/analytics';
2020-08-31 09:57:18 +09:00
import { mobile } from '../util/css';
import { NetlifyIcon, NowIcon, OcamlIcon, SpectrumIcon } from './Icons';
2019-08-01 13:21:23 +09:00
2020-06-20 18:19:05 +09:00
const supportedProviders: Record<string, React.ReactNode> = {
2020-08-31 09:57:18 +09:00
domains: <MdDomain />,
2020-06-20 18:19:05 +09:00
github: <FaGithub />,
gitlab: <FaGitlab />,
2020-08-31 09:57:18 +09:00
npm: <RiNpmjsFill />,
rust: <SiRust />,
2020-06-20 18:19:05 +09:00
pypi: <FaPython />,
2020-08-31 09:57:18 +09:00
rubygems: <SiRubygems />,
2020-06-20 18:19:05 +09:00
ocaml: <OcamlIcon />,
homebrew: <IoIosBeer />,
linux: <FaLinux />,
twitter: <FaTwitter />,
instagram: <FaInstagram />,
spectrum: <SpectrumIcon />,
slack: <FaSlack />,
heroku: <DiHeroku />,
now: <NowIcon />,
netlify: <NetlifyIcon />,
s3: <FaAws />,
2020-08-31 09:57:18 +09:00
firebase: <SiFirebase />,
2020-06-20 18:19:05 +09:00
jsorg: <FaJsSquare />,
2020-08-31 09:57:18 +09:00
githubSearch: <FaGithubAlt />,
appStore: <SiAppstore />,
playStore: <IoMdAppstore />,
nta: <RiBuilding2Fill />,
2020-08-31 08:41:53 +09:00
};
2020-06-20 18:19:05 +09:00
2019-12-24 01:57:07 +09:00
const Welcome: React.FC = () => {
2020-08-31 08:41:53 +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-31 08:41:53 +09:00
);
};
2020-07-29 14:02:27 +09:00
2020-08-31 08:41:53 +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-31 08:41:53 +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-31 08:41:53 +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-31 08:41:53 +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-31 08:41:53 +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-31 08:41:53 +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-31 08:41:53 +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-31 08:41:53 +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-31 08:41:53 +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-31 08:41:53 +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-31 08:41:53 +09:00
`;