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

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

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

Loading…
Cancel
Save