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;
|
||||
@@ -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">
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user