added skeleton for jacket art

This commit is contained in:
Polaris
2024-08-27 16:57:04 -04:00
parent e22708f98a
commit d5d62572ba
4 changed files with 78 additions and 31 deletions

View File

@ -1,5 +1,7 @@
import React, { FC } from "react";
"use client";
import React, { FC, useState } from "react";
import { getDifficultyText } from "@/lib/helpers";
import { Skeleton } from "../ui/skeleton";
type userRatingBaseList = {
title: string;
@ -32,15 +34,30 @@ export const ChunithmNextPlays: FC<ChunithmProfileHotPlays> = ({
".dds",
".png",
);
const [isLoading, setIsLoading] = useState(true);
const handleImageLoad = () => {
setIsLoading(false);
};
const handleImageError = () => {
setIsLoading(false);
};
return (
<div key={index} className="flex flex-col items-center p-2">
<div className="font-bold"></div>
{jacketPath && (
{jacketPath ? (
<img
src={`/jacketArts/${jacketPath}`}
alt="Jacket"
className="h-28 w-28"
className={`mr-2 inline-block h-[100px] w-[100px] ${
isLoading ? "hidden" : ""
}`}
onLoad={handleImageLoad}
onError={handleImageError}
/>
) : (
<Skeleton className="mr-2 inline-block h-[100px] w-[100px]" />
)}
<div>
<ul className="mt-2 text-center">