wip
This commit is contained in:
37
widgets/Image/index.tsx
Normal file
37
widgets/Image/index.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
"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;
|
||||
Reference in New Issue
Block a user