Skip to content

Commit 7f8b0ba

Browse files
author
Krzysztof Wilk
committed
Generate version 2.2.0
1 parent c9d6ae0 commit 7f8b0ba

File tree

11 files changed

+77
-42
lines changed

11 files changed

+77
-42
lines changed

README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MDB 5 React
22

3-
Version: FREE 2.1.0
3+
Version: FREE 2.2.0
44

55
Documentation:
66
https://mdbootstrap.com/docs/b5/react/

app/demo/App.tsx

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
1-
import React from "react";
2-
import { MDBBtn, MDBContainer, MDBIcon } from "mdb-react-ui-kit";
3-
1+
import React from 'react';
2+
import { MDBBtn, MDBContainer, MDBIcon } from 'mdb-react-ui-kit';
43
function App() {
54
return (
6-
<MDBContainer>
7-
<div style={{ height: '100vh' }} className='d-flex justify-content-center align-items-center'>
8-
<div className="text-center">
9-
<img className='mb-2' src='https://bf-sale.mdbgo.io/bf.png' width='800' height='450' />
10-
<h2 className='fw-bold'>Black Friday Sale</h2>
5+
<MDBContainer fluid>
6+
<div
7+
className='d-flex justify-content-center align-items-center'
8+
style={{ height: '100vh' }}
9+
>
10+
<div className='text-center'>
11+
<img
12+
className='mb-4'
13+
src='https://mdbootstrap.com/img/logo/mdb-transparent-250px.png'
14+
style={{ width: 250, height: 90 }}
15+
/>
1116
<h5 className='mb-3'>
12-
Get MDB Pro with discounts{" "}
13-
<span className='text-danger'>up to 95%</span>
17+
Thank you for using our product. We're glad you're with us.
1418
</h5>
15-
<p className="mb-3 fw-bold">Hurry up the offer is limited!</p>
16-
<a className='btn btn-black btn-lg mt-2' target='_blank' role='button' href="https://mdbootstrap.com/bf/sale/">
17-
{" "}
18-
<MDBIcon fas icon='shopping-cart' /> Get the offer
19-
</a>
19+
<p className='mb-3'>MDB Team</p>
20+
<MDBBtn
21+
tag='a'
22+
href='https://mdbootstrap.com/docs/standard/getting-started/'
23+
target='_blank'
24+
role='button'
25+
>
26+
Start MDB tutorial
27+
</MDBBtn>
28+
<p className="mt-4"><a href="https://mdbootstrap.com/sale/free/"><MDBIcon far icon='surprise' size='lg' /> Free users
29+
buy cheaper .. </a></p>
2030
</div>
2131
</div>
2232
</MDBContainer>
2333
);
2434
}
25-
26-
export default App;
35+
export default App;

app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mdb-react-ui-kit-demo",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"main": "index.js",
55
"repository": {
66
"type": "git",

app/src/components/Collapse/Collapse.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ const MDBCollapse: React.FC<CollapseProps> = ({
1818
const [showCollapseString, setShowCollapseString] = useState<string | undefined>('');
1919
const [statement, setStatement] = useState(false);
2020
const [collapseHeight, setCollapseHeight] = useState<string | number | undefined>(undefined);
21+
const [transition, setTransition] = useState(false);
22+
2123
const classes = clsx(
22-
'collapsing',
23-
'collapse',
24-
(showCollapse || statement) && 'show',
24+
transition ? 'collapsing' : 'collapse',
25+
!transition && (showCollapse || statement) && 'show',
2526
navbar && 'navbar-collapse',
2627
center && 'justify-content-center',
2728
className
@@ -49,17 +50,17 @@ const MDBCollapse: React.FC<CollapseProps> = ({
4950
setShowCollapse(show);
5051
}
5152

52-
// if (statement || showCollapse) {
53-
// setTransition(true);
54-
// }
53+
if (statement || showCollapse) {
54+
setTransition(true);
55+
}
5556

56-
// const timer = setTimeout(() => {
57-
// setTransition(false);
58-
// }, 350);
57+
const timer = setTimeout(() => {
58+
setTransition(false);
59+
}, 350);
5960

60-
// return () => {
61-
// clearTimeout(timer);
62-
// };
61+
return () => {
62+
clearTimeout(timer);
63+
};
6364
}, [show, showCollapse, id, showCollapseString, statement]);
6465

6566
useEffect(() => {

app/src/components/Modal/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ declare const MDBModal: React.FunctionComponent<{
99
appendToBody?: boolean;
1010
tabIndex?: string;
1111
show?: boolean;
12+
setShow?: React.SetStateAction<any>;
1213
staticBackdrop?: boolean;
1314
tag?: React.ComponentProps<any>;
1415
modalRef?: React.RefObject<HTMLElement>;

app/src/components/Modal/types.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ type ModalProps = {
77
appendToBody?: boolean;
88
tabIndex?: string;
99
show?: boolean;
10+
setShow?: React.SetStateAction<any>;
1011
staticBackdrop?: boolean;
1112
tag?: React.ComponentProps<any>;
1213
modalRef?: React.RefObject<HTMLElement>;

app/src/methods/Ripple/Ripple.tsx

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,25 @@ import type { RippleProps } from './types';
44
import MDBBtn from '../../components/Button/Button';
55
import MDBRippleWave from './RippleWave/RippleWave';
66

7-
const MDBRipple: React.FC<RippleProps> =
7+
const useCombinedRefs = (...refs: any) => {
8+
const targetRef = React.useRef()
9+
10+
React.useEffect(() => {
11+
refs.forEach((ref: any) => {
12+
if (!ref) return
13+
14+
if (typeof ref === 'function') {
15+
ref(targetRef.current)
16+
} else {
17+
ref.current = targetRef.current
18+
}
19+
})
20+
}, [refs])
21+
22+
return targetRef
23+
}
24+
25+
const MDBRipple: React.FC<RippleProps> = React.forwardRef<HTMLAllCollection, RippleProps>(
826
(
927
{
1028
className,
@@ -16,12 +34,13 @@ const MDBRipple: React.FC<RippleProps> =
1634
rippleColor,
1735
children,
1836
onClick,
19-
rippleRef,
2037
...props
21-
}
38+
},
39+
ref
2240
) => {
23-
const rippleEl = useRef(null);
24-
const rippleReference = rippleRef ? rippleRef : rippleEl;
41+
const rippleRef = useRef(null);
42+
const combinedRef = useCombinedRefs(ref, rippleRef);
43+
2544
const GRADIENT =
2645
'rgba({{color}}, 0.2) 0, rgba({{color}}, 0.3) 40%, rgba({{color}}, 0.4) 50%, rgba({{color}}, 0.5) 60%, rgba({{color}}, 0) 70%';
2746

@@ -161,7 +180,9 @@ const MDBRipple: React.FC<RippleProps> =
161180
};
162181

163182
const getStyles = (e: any) => {
164-
const itemRect = rippleReference.current.getBoundingClientRect();
183+
// eslint-disable-next-line
184+
// @ts-ignore
185+
const itemRect = combinedRef.current?.getBoundingClientRect();
165186

166187
const offsetX = e.clientX - itemRect.left;
167188
const offsetY = e.clientY - itemRect.top;
@@ -221,14 +242,15 @@ const MDBRipple: React.FC<RippleProps> =
221242
}, [rippleDuration, rippleStyles]);
222243

223244
return (
224-
<Tag className={classes} onClick={(e: any) => handleClick(e)} ref={rippleReference} {...props}>
245+
<Tag className={classes} onClick={(e: any) => handleClick(e)} ref={combinedRef} {...props}>
225246
{children}
226247
{rippleStyles.map((item, i) => (
227248
<MDBRippleWave key={i} style={item}></MDBRippleWave>
228249
))}
229250
</Tag>
230251
);
231-
};
252+
}
253+
);
232254

233255
MDBRipple.defaultProps = { rippleTag: 'div', rippleDuration: 500, rippleRadius: 0, rippleColor: 'dark' };
234256

dist/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ declare const MDBModal: React$1.FunctionComponent<{
646646
appendToBody?: boolean;
647647
tabIndex?: string;
648648
show?: boolean;
649+
setShow?: React$1.SetStateAction<any>;
649650
staticBackdrop?: boolean;
650651
tag?: React$1.ComponentProps<any>;
651652
modalRef?: React$1.RefObject<HTMLElement>;

dist/mdb-react-ui-kit.esm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mdb-react-ui-kit.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mdb-react-ui-kit",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"main": "./dist/mdb-react-ui-kit.js",
55
"module": "./dist/mdb-react-ui-kit.esm.js",
66
"types": "./dist/index.d.ts",

0 commit comments

Comments
 (0)