1
0
mirror of https://github.com/uetchy/namae.git synced 2025-08-20 18:08:11 +09:00

chore: cosmetic changes

This commit is contained in:
2019-09-17 14:30:26 +09:00
parent 2438518e3c
commit 6c84493360
56 changed files with 724 additions and 729 deletions

View File

@@ -1 +1 @@
export const mobile = '@media screen and (max-width: 800px)'
export const mobile = '@media screen and (max-width: 800px)';

View File

@@ -1,21 +1,21 @@
import { useState, useEffect } from 'react'
import {useState, useEffect} from 'react';
export function useDeferredState<T>(
duration = 1000,
initialValue: T
initialValue: T,
): [T, React.Dispatch<React.SetStateAction<T>>] {
const [response, setResponse] = useState(initialValue)
const [innerValue, setInnerValue] = useState(initialValue)
const [response, setResponse] = useState(initialValue);
const [innerValue, setInnerValue] = useState(initialValue);
useEffect(() => {
const fn = setTimeout(() => {
setResponse(innerValue)
}, duration)
setResponse(innerValue);
}, duration);
return () => {
clearTimeout(fn)
}
}, [duration, innerValue])
clearTimeout(fn);
};
}, [duration, innerValue]);
return [response, setInnerValue]
return [response, setInnerValue];
}

View File

@@ -1,9 +1,9 @@
import i18n from 'i18next'
import Backend from 'i18next-chained-backend'
import LocalStorageBackend from 'i18next-localstorage-backend'
import XHR from 'i18next-xhr-backend'
import LanguageDetector from 'i18next-browser-languagedetector'
import { initReactI18next } from 'react-i18next'
import i18n from 'i18next';
import Backend from 'i18next-chained-backend';
import LocalStorageBackend from 'i18next-localstorage-backend';
import XHR from 'i18next-xhr-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
import {initReactI18next} from 'react-i18next';
i18n
.use(Backend)
@@ -14,7 +14,7 @@ i18n
backends: [LocalStorageBackend, XHR],
backendOptions: [
{
versions: { en: '1.5', ja: '1.5' },
versions: {en: '1.5', ja: '1.5'},
},
],
},
@@ -23,6 +23,6 @@ i18n
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},
})
});
export default i18n
export default i18n;

View File

@@ -1,8 +1,8 @@
interface CustomNavigator extends Navigator {
standalone?: boolean
standalone?: boolean;
}
export function isStandalone() {
const navigator: CustomNavigator = window.navigator
return 'standalone' in navigator && navigator.standalone
const navigator: CustomNavigator = window.navigator;
return 'standalone' in navigator && navigator.standalone;
}

View File

@@ -1,10 +1,10 @@
import React, { Suspense } from 'react'
import styled from 'styled-components'
import BarLoader from 'react-spinners/BarLoader'
import React, {Suspense} from 'react';
import styled from 'styled-components';
import BarLoader from 'react-spinners/BarLoader';
export const FullScreenSuspense: React.FC = ({ children }) => {
return <Suspense fallback={<Fallback />}>{children}</Suspense>
}
export const FullScreenSuspense: React.FC = ({children}) => {
return <Suspense fallback={<Fallback />}>{children}</Suspense>;
};
const Container = styled.div`
width: 100vw;
@@ -13,10 +13,10 @@ const Container = styled.div`
flex-direction: column;
justify-content: center;
align-items: center;
`
`;
const Fallback = () => (
<Container>
<BarLoader />
</Container>
)
);

View File

@@ -1,3 +1,3 @@
export function capitalize(text: string) {
return text[0].toUpperCase() + text.slice(1).toLowerCase()
return text[0].toUpperCase() + text.slice(1).toLowerCase();
}