aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/views/common/dialog/DialogContainer.tsx
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2023-07-30 20:52:13 +0800
committercrupest <crupest@outlook.com>2023-07-30 20:52:13 +0800
commita148f11c193d35ba489f887ed393aedf58a1c714 (patch)
tree0028ec26d0cce5fb5a460777105be94a2084b704 /FrontEnd/src/views/common/dialog/DialogContainer.tsx
parent001712ec0ae0de86ec7d2c36e2fff8bccc55bab5 (diff)
downloadtimeline-a148f11c193d35ba489f887ed393aedf58a1c714.tar.gz
timeline-a148f11c193d35ba489f887ed393aedf58a1c714.tar.bz2
timeline-a148f11c193d35ba489f887ed393aedf58a1c714.zip
...
Diffstat (limited to 'FrontEnd/src/views/common/dialog/DialogContainer.tsx')
-rw-r--r--FrontEnd/src/views/common/dialog/DialogContainer.tsx68
1 files changed, 68 insertions, 0 deletions
diff --git a/FrontEnd/src/views/common/dialog/DialogContainer.tsx b/FrontEnd/src/views/common/dialog/DialogContainer.tsx
new file mode 100644
index 00000000..b0a87ea5
--- /dev/null
+++ b/FrontEnd/src/views/common/dialog/DialogContainer.tsx
@@ -0,0 +1,68 @@
+import { ComponentProps, Ref, ReactNode } from "react";
+import classNames from "classnames";
+
+import { ThemeColor, Text, useC } from "../common";
+import { ButtonRow } from "../button";
+
+import "./DialogContainer.css";
+
+interface DialogContainerProps {
+ className?: string;
+ title: Text;
+ titleColor?: ThemeColor;
+ titleClassName?: string;
+ titleRef?: Ref<HTMLDivElement>;
+ bodyContainerClassName?: string;
+ bodyContainerRef?: Ref<HTMLDivElement>;
+ buttons: ComponentProps<typeof ButtonRow>["buttons"];
+ buttonsClassName?: string;
+ buttonsContainerRef?: ComponentProps<typeof ButtonRow>["containerRef"];
+ children: ReactNode;
+}
+
+export default function DialogContainer({
+ className,
+ title,
+ titleColor,
+ titleClassName,
+ titleRef,
+ bodyContainerClassName,
+ bodyContainerRef,
+ buttons,
+ buttonsClassName,
+ buttonsContainerRef,
+ children,
+}: DialogContainerProps) {
+ const c = useC();
+
+ return (
+ <div className={classNames(className)}>
+ <div
+ ref={titleRef}
+ className={classNames(
+ `cru-dialog-container-title cru-${titleColor ?? "primary"}`,
+ titleClassName,
+ )}
+ >
+ {c(title)}
+ </div>
+ <hr className="cru-dialog-container-hr" />
+ <div
+ ref={bodyContainerRef}
+ className={classNames(
+ "cru-dialog-container-body",
+ bodyContainerClassName,
+ )}
+ >
+ {children}
+ </div>
+ <hr className="cru-dialog-container-hr" />
+ <ButtonRow
+ containerRef={buttonsContainerRef}
+ className={classNames("cru-dialog-container-button-row", buttonsClassName)}
+ buttons={buttons}
+ buttonsClassName="cru-dialog-container-button"
+ />
+ </div>
+ );
+}