This commit is contained in:
2025-03-22 17:15:35 +00:00
parent 0e11c4153d
commit 8a54bb29fb
11 changed files with 204 additions and 32 deletions

37
widgets/Image/index.tsx Normal file
View 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;

View File

@@ -1,10 +1,16 @@
"use client";
import "@/app/globals.css";
import { DraggablePropsType } from "@/components/Draggable/Draggable";
export const id = "logo";
export const name = "Logo";
export const version = "1.0.0";
export default function Logo() {
export const defaultConfig = (config: DraggablePropsType['data']) => {
return {
...config
}
}
export default function WidgetsLogo() {
return (
<div className="flex h-full w-full items-center justify-center text-5xl bg-base-200 font-bold">
<span className="whitespace-nowrap text-primary">

View File

@@ -3,7 +3,14 @@ import { DraggablePropsType } from '../../components/Draggable/Draggable';
export const id = "text";
export const name = "文字";
export const version = "1.0.0";
export const version = "1.0.0";
export const defaultConfig = (config: FontData) => {
return {
textAlign: 'center',
content: '默认文本',
...config,
}
}
type FontData = {
content: string;
fontSize?: number; // 字体大小px
@@ -21,7 +28,7 @@ interface ResponsiveTextProps {
className?: string; // 外部容器类名
}
const Text: React.FC<ResponsiveTextProps> = ({
const WidgetsText: React.FC<ResponsiveTextProps> = ({
data,
className
}) => {
@@ -76,4 +83,4 @@ const Text: React.FC<ResponsiveTextProps> = ({
);
};
export default Text;
export default WidgetsText;