Rebuild all components
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 4s
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 4s
This commit is contained in:
@@ -2,41 +2,41 @@
|
||||
import { Tag } from "sigpro";
|
||||
|
||||
export const Chat = (props, children) => {
|
||||
const { class: className, ...rest } = props;
|
||||
return Tag("div", {
|
||||
...rest,
|
||||
class: `chat ${className || ''}`.trim()
|
||||
}, children);
|
||||
children === undefined && (children = props, props = {});
|
||||
return Tag("div", { ...props, class: `chat ${props.class ?? ''}` }, children);
|
||||
};
|
||||
|
||||
export const ChatImage = (props, children) => {
|
||||
const { class: className, ...rest } = props;
|
||||
return Tag("div", {
|
||||
...rest,
|
||||
class: `chat-image ${className || ''}`.trim()
|
||||
}, children);
|
||||
children === undefined && (children = props, props = {});
|
||||
return Tag("div", { ...props, class: `chat-image avatar ${props.class ?? ''}` },
|
||||
Tag("div", { class: "w-10 rounded-full" },
|
||||
typeof children === "string" ? Tag("img", { src: children, alt: "avatar" }) : children
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
export const ChatHeader = (props, children) => {
|
||||
const { class: className, ...rest } = props;
|
||||
return Tag("div", {
|
||||
...rest,
|
||||
class: `chat-header ${className || ''}`.trim()
|
||||
}, children);
|
||||
children === undefined && (children = props, props = {});
|
||||
return Tag("div", { ...props, class: `chat-header ${props.class ?? ''}` }, children);
|
||||
};
|
||||
|
||||
export const ChatFooter = (props, children) => {
|
||||
const { class: className, ...rest } = props;
|
||||
return Tag("div", {
|
||||
...rest,
|
||||
class: `chat-footer ${className || ''}`.trim()
|
||||
}, children);
|
||||
children === undefined && (children = props, props = {});
|
||||
return Tag("div", { ...props, class: `chat-footer ${props.class ?? ''}` }, children);
|
||||
};
|
||||
|
||||
export const ChatBubble = (props, children) => {
|
||||
const { class: className, ...rest } = props;
|
||||
return Tag("div", {
|
||||
...rest,
|
||||
class: `chat-bubble ${className || ''}`.trim()
|
||||
}, children);
|
||||
children === undefined && (children = props, props = {});
|
||||
return Tag("div", { ...props, class: `chat-bubble ${props.class ?? ''}` }, children);
|
||||
};
|
||||
|
||||
export const ChatMessage = (props) => {
|
||||
const { position = "start", avatar, header, message, footer, bubbleClass, ...rest } = props;
|
||||
|
||||
return Chat({ ...rest, class: `chat-${position} ${props.class ?? ''}` }, [
|
||||
avatar && ChatImage(avatar),
|
||||
header && ChatHeader(header),
|
||||
ChatBubble({ class: bubbleClass }, message),
|
||||
footer && ChatFooter(footer)
|
||||
]);
|
||||
};
|
||||
Reference in New Issue
Block a user