mirror of
https://github.com/uetchy/namae.git
synced 2025-03-17 04:30:31 +09:00
feat: add legend
This commit is contained in:
parent
8374816cc6
commit
8b850fa09f
@ -32,5 +32,7 @@
|
|||||||
"showMore": "show more",
|
"showMore": "show more",
|
||||||
"noResult": "No Result",
|
"noResult": "No Result",
|
||||||
"gettingStarted": "Getting Started",
|
"gettingStarted": "Getting Started",
|
||||||
"pressEnterToSearch": "Press Enter to search"
|
"pressEnterToSearch": "Press Enter to search",
|
||||||
|
"available": "Available",
|
||||||
|
"unavailable": "Unavailable"
|
||||||
}
|
}
|
||||||
|
@ -32,5 +32,7 @@
|
|||||||
"showMore": "もっと見る",
|
"showMore": "もっと見る",
|
||||||
"noResult": "該当なし",
|
"noResult": "該当なし",
|
||||||
"gettingStarted": "試してみる",
|
"gettingStarted": "試してみる",
|
||||||
"pressEnterToSearch": "エンターキーで検索"
|
"pressEnterToSearch": "エンターキーで検索",
|
||||||
|
"available": "取得可能",
|
||||||
|
"unavailable": "取得済み"
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,18 @@ import styled, {createGlobalStyle} from 'styled-components';
|
|||||||
import {Helmet} from 'react-helmet';
|
import {Helmet} from 'react-helmet';
|
||||||
import {useTranslation} from 'react-i18next';
|
import {useTranslation} from 'react-i18next';
|
||||||
import {Switch, Route, useParams, Redirect} from 'react-router-dom';
|
import {Switch, Route, useParams, Redirect} from 'react-router-dom';
|
||||||
|
import {IoIosRocket, IoIosFlash} from 'react-icons/io';
|
||||||
|
|
||||||
import Welcome from './components/Welcome';
|
import Welcome from './components/Welcome';
|
||||||
import Form from './components/Form';
|
import Form from './components/Form';
|
||||||
import Cards from './components/cards';
|
import Cards from './components/cards';
|
||||||
|
import {
|
||||||
|
ResultItem,
|
||||||
|
ResultIcon,
|
||||||
|
ResultName,
|
||||||
|
COLORS,
|
||||||
|
AvailableIcon,
|
||||||
|
} from './components/cards/core';
|
||||||
import Footer from './components/Footer';
|
import Footer from './components/Footer';
|
||||||
|
|
||||||
import {mobile} from './util/css';
|
import {mobile} from './util/css';
|
||||||
@ -54,6 +62,7 @@ function Home() {
|
|||||||
function Search() {
|
function Search() {
|
||||||
const {query} = useParams<{query: string}>();
|
const {query} = useParams<{query: string}>();
|
||||||
const currentQuery = sanitize(query);
|
const currentQuery = sanitize(query);
|
||||||
|
const {t} = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -63,6 +72,23 @@ function Search() {
|
|||||||
<Header>
|
<Header>
|
||||||
<Form initialValue={currentQuery} />
|
<Form initialValue={currentQuery} />
|
||||||
</Header>
|
</Header>
|
||||||
|
<Legend>
|
||||||
|
<ResultItem color={COLORS.available}>
|
||||||
|
<ResultIcon>
|
||||||
|
<IoIosRocket />
|
||||||
|
</ResultIcon>
|
||||||
|
<ResultName>{t('available')}</ResultName>
|
||||||
|
<AvailableIcon>
|
||||||
|
<IoIosFlash />
|
||||||
|
</AvailableIcon>
|
||||||
|
</ResultItem>
|
||||||
|
<ResultItem color={COLORS.unavailable}>
|
||||||
|
<ResultIcon>
|
||||||
|
<IoIosRocket />
|
||||||
|
</ResultIcon>
|
||||||
|
<ResultName>{t('unavailable')}</ResultName>
|
||||||
|
</ResultItem>
|
||||||
|
</Legend>
|
||||||
<Content>
|
<Content>
|
||||||
<Cards query={currentQuery} />
|
<Cards query={currentQuery} />
|
||||||
</Content>
|
</Content>
|
||||||
@ -70,6 +96,27 @@ function Search() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Legend = styled.div`
|
||||||
|
padding: 80px 0 30px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
user-select: none;
|
||||||
|
cursor: default;
|
||||||
|
background-color: #f6f6fa;
|
||||||
|
|
||||||
|
${mobile} {
|
||||||
|
padding: 60px 0 20px;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
background-color: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
${ResultItem} {
|
||||||
|
margin: 0 20px 0;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
const GlobalStyle = createGlobalStyle`
|
const GlobalStyle = createGlobalStyle`
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -89,7 +136,7 @@ body {
|
|||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
|
|
||||||
${mobile} {
|
${mobile} {
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
}
|
}
|
||||||
@ -97,10 +144,10 @@ body {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const Content = styled.div`
|
const Content = styled.div`
|
||||||
padding-top: 100px;
|
/* padding-top: 100px; */
|
||||||
|
|
||||||
${mobile} {
|
${mobile} {
|
||||||
padding-top: 60px;
|
/* padding-top: 60px; */
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import {OutboundLink} from 'react-ga';
|
|||||||
import {sendError, sendExpandEvent} from '../../util/analytics';
|
import {sendError, sendExpandEvent} from '../../util/analytics';
|
||||||
import {mobile} from '../../util/css';
|
import {mobile} from '../../util/css';
|
||||||
|
|
||||||
const COLORS = {
|
export const COLORS = {
|
||||||
available: '#6e00ff',
|
available: '#6e00ff',
|
||||||
unavailable: 'darkgrey',
|
unavailable: 'darkgrey',
|
||||||
error: '#ff388b',
|
error: '#ff388b',
|
||||||
@ -205,7 +205,8 @@ export const Result: React.FC<{
|
|||||||
position="bottom"
|
position="bottom"
|
||||||
arrow={true}
|
arrow={true}
|
||||||
animation="shift"
|
animation="shift"
|
||||||
duration="200">
|
duration="200"
|
||||||
|
>
|
||||||
<ResultItem color={itemColor}>
|
<ResultItem color={itemColor}>
|
||||||
<ResultIcon>{icon}</ResultIcon>
|
<ResultIcon>{icon}</ResultIcon>
|
||||||
<ResultName>
|
<ResultName>
|
||||||
@ -213,7 +214,8 @@ export const Result: React.FC<{
|
|||||||
<OutboundLink
|
<OutboundLink
|
||||||
to={link}
|
to={link}
|
||||||
eventLabel={link.split('/')[2]}
|
eventLabel={link.split('/')[2]}
|
||||||
target="_blank">
|
target="_blank"
|
||||||
|
>
|
||||||
{content}
|
{content}
|
||||||
</OutboundLink>
|
</OutboundLink>
|
||||||
) : (
|
) : (
|
||||||
@ -270,7 +272,8 @@ class ErrorBoundary extends React.Component<
|
|||||||
position="bottom"
|
position="bottom"
|
||||||
arrow={true}
|
arrow={true}
|
||||||
animation="shift"
|
animation="shift"
|
||||||
duration="200">
|
duration="200"
|
||||||
|
>
|
||||||
<ResultItem color={COLORS.error}>
|
<ResultItem color={COLORS.error}>
|
||||||
<ResultIcon>
|
<ResultIcon>
|
||||||
<GoInfo />
|
<GoInfo />
|
||||||
@ -292,7 +295,8 @@ const ErrorHandler: React.FC = ({children}) => (
|
|||||||
<ResultContainer>
|
<ResultContainer>
|
||||||
<BarLoader />
|
<BarLoader />
|
||||||
</ResultContainer>
|
</ResultContainer>
|
||||||
}>
|
}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
@ -351,11 +355,11 @@ const ResultContainer = styled.div`
|
|||||||
padding: 4px 0;
|
padding: 4px 0;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const ResultIcon = styled.div`
|
export const ResultIcon = styled.div`
|
||||||
width: 1em;
|
width: 1em;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const ResultItem = styled.div`
|
export const ResultItem = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
@ -363,7 +367,7 @@ const ResultItem = styled.div`
|
|||||||
color: ${({color}) => color};
|
color: ${({color}) => color};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const ResultName = styled.div`
|
export const ResultName = styled.div`
|
||||||
margin-left: 6px;
|
margin-left: 6px;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
|
|
||||||
@ -373,7 +377,7 @@ const ResultName = styled.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const AvailableIcon = styled.div`
|
export const AvailableIcon = styled.div`
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
margin-left: 3px;
|
margin-left: 3px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -5,7 +5,7 @@ import XHR from 'i18next-xhr-backend';
|
|||||||
import LanguageDetector from 'i18next-browser-languagedetector';
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
||||||
import {initReactI18next} from 'react-i18next';
|
import {initReactI18next} from 'react-i18next';
|
||||||
|
|
||||||
const TRANSLATION_VERSION = '1.12';
|
const TRANSLATION_VERSION = '1.13';
|
||||||
|
|
||||||
i18n
|
i18n
|
||||||
.use(Backend)
|
.use(Backend)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user