Remove isRotating usage

pull/162/head
Alex Kern 12 months ago
parent 0717e3e6be
commit 384d58642b
No known key found for this signature in database
GPG Key ID: EF051FACCACBEE25

@ -17,16 +17,10 @@ import TitleText from '../components/TitleText'
import { pluralize } from '../utils/pluralize'
import TermsAcceptance from '../components/TermsAcceptance'
function PageWrapper({
children,
isRotating = false,
}: {
children: React.ReactNode
isRotating?: boolean
}): JSX.Element {
function PageWrapper({ children }: { children: React.ReactNode }): JSX.Element {
return (
<div className="flex flex-col items-center space-y-5 py-10 max-w-2xl mx-auto px-4">
<Spinner direction="up" isRotating={isRotating} />
<Spinner direction="up" />
<Wordmark />
{children}
</div>
@ -101,7 +95,7 @@ function UploadingState({
}): JSX.Element {
const fileListData = useUploaderFileListData(uploadedFiles)
return (
<PageWrapper isRotating={true}>
<PageWrapper>
<TitleText>
You are uploading {pluralize(uploadedFiles.length, 'file', 'files')}.
</TitleText>

@ -49,8 +49,10 @@ export function Footer(): JSX.Element {
<p className="text-stone-600 dark:text-stone-400">
Cooked up by{' '}
<FooterLink href="http://kern.io">Alex Kern</FooterLink> &amp;{' '}
<FooterLink href="https://github.com/neerajbaid">Neeraj Baid</FooterLink> while
eating <strong>Sliver</strong> @ UC Berkeley &middot;{' '}
<FooterLink href="https://github.com/neerajbaid">
Neeraj Baid
</FooterLink>{' '}
while eating <strong>Sliver</strong> @ UC Berkeley &middot;{' '}
<FooterLink href="https://github.com/kern/filepizza#faq">
FAQ
</FooterLink>{' '}

@ -6,37 +6,37 @@ let isRotating = false
const listeners = new Set<RotationListener>()
export function setRotating(rotating: boolean): void {
isRotating = rotating
notifyListeners()
isRotating = rotating
notifyListeners()
}
export function getRotating(): boolean {
return isRotating
return isRotating
}
export function addRotationListener(listener: RotationListener): void {
listeners.add(listener)
listeners.add(listener)
}
export function removeRotationListener(listener: RotationListener): void {
listeners.delete(listener)
listeners.delete(listener)
}
function notifyListeners(): void {
listeners.forEach(listener => listener(isRotating))
listeners.forEach((listener) => listener(isRotating))
}
export function useRotatingSpinner(): boolean {
const [rotating, setRotatingState] = useState(isRotating)
const [rotating, setRotatingState] = useState(isRotating)
useEffect(() => {
const listener = (newRotating: boolean) => {
setRotatingState(newRotating)
}
useEffect(() => {
const listener = (newRotating: boolean) => {
setRotatingState(newRotating)
}
addRotationListener(listener)
return () => removeRotationListener(listener)
}, [])
addRotationListener(listener)
return () => removeRotationListener(listener)
}, [])
return rotating
return rotating
}

Loading…
Cancel
Save