import React, { useState, useEffect } from 'react'
import { storiesMetadata } from './loading-swaps-quotes-stories-metadata'
import LoadingSwapsQuotes from './loading-swaps-quotes'
export default {
title: 'LoadingSwapsQuotes',
}
export const FasterThanExpectedCompletion = () => {
const [loading, setLoading] = useState(false)
const [loadingComplete, setLoadingComplete] = useState(false)
const [done, setDone] = useState(false)
useEffect(() => {
if (!done && !loading) {
setLoading(true)
setTimeout(() => {
setLoading(false)
setLoadingComplete(true)
}, 3000)
}
}, [done, loading])
return (
setDone(true)}
aggregatorMetadata={storiesMetadata}
/>
)
}
export const SlowerThanExpectedCompletion = () => {
const [loading, setLoading] = useState(false)
const [loadingComplete, setLoadingComplete] = useState(false)
const [done, setDone] = useState(false)
useEffect(() => {
if (!done && !loading) {
setLoading(true)
setTimeout(() => {
setLoading(false)
setLoadingComplete(true)
}, 10000)
}
}, [done, loading])
return (
setDone(true)}
aggregatorMetadata={storiesMetadata}
/>
)
}
export const FasterThanExpectedCompletionWithError = () => {
const [loading, setLoading] = useState(false)
const [loadingComplete, setLoadingComplete] = useState(false)
const [done, setDone] = useState(false)
useEffect(() => {
if (!done && !loading) {
setLoading(true)
setTimeout(() => {
setLoading(false)
setLoadingComplete(true)
}, 3000)
}
}, [done, loading])
return (
setDone(true)}
aggregatorMetadata={storiesMetadata}
/>
)
}