mirror of
https://github.com/uetchy/namae.git
synced 2025-08-20 18:08:11 +09:00
feat(web): typescript
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
|
||||
export function useDeferredState(duration = 1000, initialValue = undefined) {
|
||||
export function useDeferredState<T>(
|
||||
duration = 1000,
|
||||
initialValue: T
|
||||
): [T, React.Dispatch<React.SetStateAction<T>>] {
|
||||
const [response, setResponse] = useState(initialValue)
|
||||
const [innerValue, setInnerValue] = useState(initialValue)
|
||||
|
@@ -1,3 +0,0 @@
|
||||
export function isStandalone() {
|
||||
return 'standalone' in window.navigator && window.navigator.standalone
|
||||
}
|
8
web/src/util/pwa.ts
Normal file
8
web/src/util/pwa.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
interface CustomNavigator extends Navigator {
|
||||
standalone?: boolean
|
||||
}
|
||||
|
||||
export function isStandalone() {
|
||||
const navigator: CustomNavigator = window.navigator
|
||||
return 'standalone' in navigator && navigator.standalone
|
||||
}
|
@@ -2,7 +2,7 @@ import React, { Suspense } from 'react'
|
||||
import styled from 'styled-components'
|
||||
import BarLoader from 'react-spinners/BarLoader'
|
||||
|
||||
export function FullScreenSuspense({ children }) {
|
||||
export const FullScreenSuspense: React.FC = ({ children }) => {
|
||||
return <Suspense fallback={<Fallback />}>{children}</Suspense>
|
||||
}
|
||||
|
@@ -1,3 +1,3 @@
|
||||
export function capitalize(text) {
|
||||
export function capitalize(text: string) {
|
||||
return text[0].toUpperCase() + text.slice(1).toLowerCase()
|
||||
}
|
Reference in New Issue
Block a user