never set className to false

This commit is contained in:
Thomas Ruoff
2021-06-18 23:31:12 +02:00
parent 67cf096db2
commit f5892da1d8

View File

@@ -1,3 +1,4 @@
import classnames from 'classnames'
import Spinner from './spinner' import Spinner from './spinner'
export default function Loading({ export default function Loading({
@@ -7,9 +8,12 @@ export default function Loading({
loading: boolean loading: boolean
children: any children: any
}) { }) {
const classNames = classnames({
'opacity-50': loading,
})
return ( return (
<div data-testid="wrapper" className="relative"> <div className="relative">
<div className={loading && 'opacity-50'}>{children}</div> <div className={classNames}>{children}</div>
{loading && ( {loading && (
<div className="absolute inset-0 w-full h-full flex justify-center items-center pointer-events-node"> <div className="absolute inset-0 w-full h-full flex justify-center items-center pointer-events-node">
<Spinner /> <Spinner />