38 lines
866 B
TypeScript
38 lines
866 B
TypeScript
"use client";
|
|
import "@/app/globals.css";
|
|
import { DraggablePropsType } from "@/components/Draggable/Draggable";
|
|
// import Image from "next/Image";
|
|
import { CSSProperties } from "react";
|
|
|
|
export const id = "image";
|
|
export const name = "Image";
|
|
export const version = "1.0.0";
|
|
export const defaultConfig = (config: ImageData) => {
|
|
return {
|
|
src: 'https://www.todaybing.com/api/today',
|
|
...config,
|
|
}
|
|
}
|
|
|
|
type ImageData = {
|
|
src: string;
|
|
customStyles?: CSSProperties; // 自定义CSS扩展
|
|
};
|
|
|
|
interface ResponsiveImageProps {
|
|
data: DraggablePropsType["data"] & ImageData;
|
|
className?: string; // 外部容器类名
|
|
}
|
|
|
|
|
|
const WidgetsImage: React.FC<ResponsiveImageProps> = ({
|
|
data,
|
|
className
|
|
}) => {
|
|
return (
|
|
<img className="w-full h-full object-cover" src={data.src} style={data.customStyles} />
|
|
);
|
|
}
|
|
|
|
export default WidgetsImage;
|