Initial commit
This commit is contained in:
17
src/components/Image/index.tsx
Normal file
17
src/components/Image/index.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { useState } from "react";
|
||||
|
||||
const Image = ({ className, ...props }) => {
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
|
||||
return (
|
||||
<img
|
||||
className={`inline-block align-top opacity-0 transition-opacity ${
|
||||
loaded && "opacity-100"
|
||||
} ${className}`}
|
||||
onLoad={() => setLoaded(true)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default Image;
|
||||
Reference in New Issue
Block a user