1
0
mirror of https://github.com/uetchy/namae.git synced 2025-07-01 22:10:04 +09:00
namae/src/App.js

132 lines
3.2 KiB
JavaScript
Raw Normal View History

2019-07-27 19:18:54 +09:00
import React from 'react'
2019-07-31 04:01:40 +09:00
import styled from 'styled-components'
2019-07-31 03:43:13 +09:00
import { FaTwitter, FaGlobe } from 'react-icons/fa'
2019-07-30 23:27:28 +09:00
import { useDeferredState } from './hooks/state'
import { CardHolder } from './components/Card'
import GithubCard from './components/GithubCard'
2019-07-31 02:14:56 +09:00
import DomainCard from './components/DomainCard'
import HomebrewCard from './components/HomebrewCard'
2019-07-30 23:27:28 +09:00
import TwitterCard from './components/TwitterCard'
2019-07-31 02:14:56 +09:00
import SlackCard from './components/SlackCard'
2019-07-30 23:27:28 +09:00
import NpmCard from './components/NpmCard'
2019-07-31 00:18:58 +09:00
import JsOrgCard from './components/JsOrgCard'
2019-07-31 01:43:12 +09:00
import PypiCard from './components/PypiCard'
2019-07-31 02:22:05 +09:00
import S3Card from './components/S3Card'
2019-07-31 03:17:56 +09:00
import CratesioCard from './components/CratesioCard'
2019-07-27 19:18:54 +09:00
2019-07-30 23:27:28 +09:00
export default function App() {
const [query, setQuery] = useDeferredState(1000)
2019-07-27 19:18:54 +09:00
function onChange(e) {
setQuery(e.target.value)
}
return (
2019-07-30 23:27:28 +09:00
<>
2019-07-31 03:43:13 +09:00
<Header>
<Logo>namae.dev</Logo>
<SubHeader>name your new project</SubHeader>
2019-07-30 23:27:28 +09:00
<Input
onChange={onChange}
2019-07-31 03:43:13 +09:00
type="text"
2019-07-30 23:27:28 +09:00
placeholder="awesome-package"
2019-07-31 03:58:59 +09:00
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"
2019-07-30 23:27:28 +09:00
/>
2019-07-31 03:43:13 +09:00
</Header>
2019-07-30 23:27:28 +09:00
{query && query.length > 0 ? (
2019-07-31 00:18:58 +09:00
<Result>
2019-07-30 23:27:28 +09:00
<ResultHeader>Result for {query}</ResultHeader>
<CardHolder>
<GithubCard name={query} />
2019-07-31 02:08:41 +09:00
<DomainCard name={query} />
2019-07-31 02:14:56 +09:00
<TwitterCard name={query} />
2019-07-31 04:25:24 +09:00
<HomebrewCard name={query} />
2019-07-30 23:27:28 +09:00
<NpmCard name={query} />
2019-07-31 01:43:12 +09:00
<PypiCard name={query} />
2019-07-31 03:17:56 +09:00
<CratesioCard name={query} />
2019-07-31 04:25:24 +09:00
<JsOrgCard name={query} />
<SlackCard name={query} />
2019-07-31 02:22:05 +09:00
<S3Card name={query} />
2019-07-30 23:27:28 +09:00
</CardHolder>
2019-07-31 00:18:58 +09:00
</Result>
2019-07-30 23:27:28 +09:00
) : null}
2019-07-31 03:43:13 +09:00
<Footer>
<p>
2019-07-31 03:46:12 +09:00
Made by U with{' '}
2019-07-31 03:43:13 +09:00
<span role="img" aria-label="love">
🐤
</span>{' '}
<a
href="https://twitter.com/uetschy"
target="_blank"
rel="noopener noreferrer">
<FaTwitter />
</a>{' '}
<a href="https://uechi.io" target="_blank" rel="noopener noreferrer">
<FaGlobe />
</a>
</p>
</Footer>
2019-07-30 23:27:28 +09:00
</>
2019-07-27 19:18:54 +09:00
)
}
2019-07-31 03:43:13 +09:00
const Header = styled.header`
2019-07-31 00:26:49 +09:00
text-align: center;
`
2019-07-31 03:43:13 +09:00
const Logo = styled.div`
margin: 15px 0 5px;
font-family: sans-serif;
font-weight: bold;
`
const SubHeader = styled.div`
font-size: 0.8em;
font-style: italic;
`
2019-07-30 23:27:28 +09:00
const Input = styled.input`
width: 100%;
2019-07-31 03:43:13 +09:00
margin-top: 20px;
2019-07-30 23:27:28 +09:00
padding: 20px;
outline: none;
2019-07-31 03:52:17 +09:00
text-align: center;
2019-07-30 23:27:28 +09:00
font-size: 4rem;
font-family: monospace;
2019-07-31 00:26:49 +09:00
border: none;
2019-07-31 03:52:17 +09:00
transition: box-shadow 0.5s ease-out;
&:hover {
2019-07-31 03:58:59 +09:00
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
2019-07-31 03:52:17 +09:00
}
2019-07-30 23:27:28 +09:00
@media screen and (max-width: 800px) {
font-size: 2rem;
}
`
2019-07-31 00:18:58 +09:00
const Result = styled.div`
2019-07-30 23:27:28 +09:00
margin-top: 40px;
`
2019-07-31 00:18:58 +09:00
const ResultHeader = styled.div`
2019-07-30 23:27:28 +09:00
padding-left: 20px;
margin-bottom: 20px;
2019-07-31 00:18:58 +09:00
font-size: 1.2rem;
font-weight: bold;
2019-07-30 23:27:28 +09:00
`
2019-07-31 03:43:13 +09:00
const Footer = styled.footer`
2019-07-31 03:52:17 +09:00
margin: 40px 0;
2019-07-31 03:43:13 +09:00
text-align: center;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-size: 0.8em;
`