92a3337aeb
CI Pipeline / test (20) (pull_request) Successful in 2m41s
CI Pipeline / test (18) (pull_request) Successful in 3m21s
CI Pipeline / e2e (chromium) (pull_request) Failing after 1m25s
CI Pipeline / e2e (firefox) (pull_request) Failing after 1m24s
CI Pipeline / e2e (webkit) (pull_request) Failing after 1m24s
CI Pipeline / visual-regression (pull_request) Failing after 1m53s
CI Pipeline / performance (pull_request) Failing after 1m31s
CI Pipeline / lint (pull_request) Failing after 1m5s
CI Pipeline / storybook (pull_request) Successful in 1m36s
CI Pipeline / build (pull_request) Failing after 1m19s
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import React, { memo } from "react";
|
|
|
|
interface ImagePlaceholderProps {
|
|
width?: number;
|
|
height?: number;
|
|
text?: string;
|
|
color?: "blue" | "green" | "purple" | "red" | "orange" | "teal";
|
|
className?: string;
|
|
}
|
|
|
|
/**
|
|
* Simple image placeholder component for testing
|
|
* Generates colored backgrounds with text overlays
|
|
*/
|
|
const ImagePlaceholder = memo<ImagePlaceholderProps>(
|
|
({
|
|
width = 260,
|
|
height = 390,
|
|
text = "Blog Image",
|
|
color = "blue",
|
|
className = "",
|
|
}) => {
|
|
const colors: Record<string, string> = {
|
|
blue: "bg-blue-500",
|
|
green: "bg-green-500",
|
|
purple: "bg-purple-500",
|
|
red: "bg-red-500",
|
|
orange: "bg-orange-500",
|
|
teal: "bg-teal-500",
|
|
};
|
|
|
|
const bgColor = colors[color] || colors.blue;
|
|
|
|
return (
|
|
<div
|
|
className={`${bgColor} flex items-center justify-center text-white font-bold text-lg ${className}`}
|
|
style={{ width: `${width}px`, height: `${height}px` }}
|
|
>
|
|
{text}
|
|
</div>
|
|
);
|
|
},
|
|
);
|
|
|
|
ImagePlaceholder.displayName = "ImagePlaceholder";
|
|
|
|
export default ImagePlaceholder;
|