Skip to content

Commit de92a84

Browse files
selfcontainedroboquat
authored andcommitted
cleanup and apply sub-components when title exists
1 parent 6e6883c commit de92a84

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

components/dashboard/src/components/Modal.tsx

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,9 @@ export default function Modal(props: {
9494
)}
9595
{props.title ? (
9696
<>
97-
<h3 className="pb-2">{props.title}</h3>
98-
<div
99-
className={
100-
"overflow-scroll border-gray-200 dark:border-gray-800 -mx-6 px-6 " +
101-
(props.hideDivider ? "" : "border-t border-b mt-2 py-4")
102-
}
103-
>
104-
{props.children}
105-
</div>
106-
<div className="flex justify-end mt-6 space-x-2">{props.buttons}</div>
97+
<ModalHeader>{props.title}</ModalHeader>
98+
<ModalBody hideDivider={props.hideDivider}>{props.children}</ModalBody>
99+
<ModalFooter>{props.buttons}</ModalFooter>
107100
</>
108101
) : (
109102
props.children
@@ -119,7 +112,6 @@ type ModalHeaderProps = {
119112
};
120113

121114
export const ModalHeader = ({ children }: ModalHeaderProps) => {
122-
// TODO: some modals are using mb-4 for spacing, which do we want?
123115
return <h3 className="pb-2">{children}</h3>;
124116
};
125117

@@ -129,14 +121,6 @@ type ModalBodyProps = {
129121
};
130122

131123
export const ModalBody = ({ children, hideDivider = false }: ModalBodyProps) => {
132-
// TODO: add className propr
133-
134-
// EnvVar body classes
135-
// border-t border-b border-gray-200 dark:border-gray-800 -mx-6 px-6 py-4 flex flex-col
136-
// space-y-4 border-t border-b border-gray-200 dark:border-gray-800 mt-2 -mx-6 px-6 py-4
137-
138-
// Integrations body classes:
139-
// border-t border-b border-gray-200 dark:border-gray-800 mt-2 -mx-6 px-6 py-4
140124
return (
141125
<div
142126
className={cn("overflow-scroll border-gray-200 dark:border-gray-800 -mx-6 px-6 ", {
@@ -152,11 +136,5 @@ type ModalFooterProps = {
152136
children: ReactNode;
153137
};
154138
export const ModalFooter = ({ children }: ModalFooterProps) => {
155-
// EnvVars styles
156-
// flex justify-end mt-6
157-
158-
// Integrations styles
159-
// flex justify-end mt-6
160-
// TODO: verify space-x-2 won't cause issues when there's only 1 button vs. more
161139
return <div className="flex justify-end mt-6 space-x-2">{children}</div>;
162140
};

0 commit comments

Comments
 (0)