Skip to content

Commit 42cee72

Browse files
committed
feat(@clayui/modal): Allow setting CSS classes and other properties on ClayModal.Footer and ClayModal.Body
1 parent 87d4a3f commit 42cee72

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

packages/clay-modal/src/Body.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ export interface IBodyProps extends React.HTMLAttributes<HTMLDivElement> {
2525

2626
const ClayModalBody: React.FunctionComponent<IBodyProps> = ({
2727
children,
28+
className,
2829
iFrameProps = {},
2930
scrollable,
3031
url,
32+
...otherProps
3133
}: IBodyProps) => {
3234
const elementRef = useRef<HTMLDivElement | null>(null);
3335

@@ -55,12 +57,13 @@ const ClayModalBody: React.FunctionComponent<IBodyProps> = ({
5557

5658
return (
5759
<div
58-
className={classNames('modal-body', {
60+
className={classNames('modal-body', className, {
5961
'inline-scroller': scrollable,
6062
'modal-body-iframe': url,
6163
})}
6264
ref={elementRef}
6365
tabIndex={scrollable ? -1 : undefined}
66+
{...otherProps}
6467
>
6568
{url ? <iframe {...iFrameProps} src={url} title={url} /> : children}
6669
</div>

packages/clay-modal/src/Footer.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
* SPDX-License-Identifier: BSD-3-Clause
44
*/
55

6+
import classNames from 'classnames';
67
import React from 'react';
78

8-
export interface IFooterProps {
9+
export interface IFooterProps extends React.HTMLAttributes<HTMLDivElement> {
910
/**
1011
* Sets the elements that are positioned `first following
1112
* the LTR direction on the footer.
@@ -26,15 +27,19 @@ export interface IFooterProps {
2627
}
2728

2829
const ClayModalFooter: React.FunctionComponent<IFooterProps> = ({
30+
className,
2931
first,
3032
last,
3133
middle,
32-
}: IFooterProps) => (
33-
<div className="modal-footer">
34-
<div className="modal-item-first">{first}</div>
35-
<div className="modal-item">{middle}</div>
36-
<div className="modal-item-last">{last}</div>
37-
</div>
38-
);
34+
...otherProps
35+
}: IFooterProps) => {
36+
return (
37+
<div className={classNames('modal-footer', className)} {...otherProps}>
38+
<div className="modal-item-first">{first}</div>
39+
<div className="modal-item">{middle}</div>
40+
<div className="modal-item-last">{last}</div>
41+
</div>
42+
);
43+
};
3944

4045
export default ClayModalFooter;

0 commit comments

Comments
 (0)