@@ -3,15 +3,17 @@ import * as React from 'react';
33import * as ReactDOM from 'react-dom' ;
44import { ModalProvider , Modal , useModal } from '../dist/index' ;
55import '../dist/styles.css' ;
6+ import './styles.css' ;
67
78const ModalContent = ( { onCloseClicked } ) => {
89 const { isModalOpen, openModal, closeModal } = useModal ( ) ;
10+ const [ toggle , setToggle ] = React . useState ( false ) ;
911
1012 return (
1113 < >
1214 < div > This modal can be closed by clicking the close button below.</ div >
1315 < button
14- className = "rsm- p-3 rsm- bg-red-500 rsm- text-white rsm- rounded rsm- mt-4 rsm- mr-4"
16+ className = "p-3 bg-red-500 text-white rounded mt-4 mr-4"
1517 onClick = { onCloseClicked }
1618 >
1719 Close this modal
@@ -22,16 +24,34 @@ const ModalContent = ({ onCloseClicked }) => {
2224 isOpen = { isModalOpen }
2325 onBackdropClick = { closeModal }
2426 />
25- < div className = "rsm- mt-8" >
27+ < div className = "mt-8" >
2628 Open another modal which will appear stacked on top of the current
2729 modal.
2830 </ div >
2931 < button
30- className = "rsm- p-3 rsm- bg-blue-500 rsm- text-white rsm- rounded rsm- mt-4"
32+ className = "p-3 bg-blue-500 text-white rounded mt-4"
3133 onClick = { openModal }
3234 >
3335 Open next modal
3436 </ button >
37+ < div className = "mt-8" >
38+ Toggle some long content to see how react-simple-hook-modal behaves.
39+ </ div >
40+ < button
41+ className = "p-3 bg-blue-700 text-white rounded mt-4"
42+ onClick = { ( ) => setToggle ( prev => ! prev ) }
43+ >
44+ Toggle long content
45+ </ button >
46+ { toggle ? (
47+ < div className = "mt-4" >
48+ { [ ...Array ( 30 ) ] . map ( ( e , i ) => (
49+ < p key = { i } className = "mb-2" >
50+ Are you using react-simple-hook-modal yet?
51+ </ p >
52+ ) ) }
53+ </ div >
54+ ) : null }
3555 </ >
3656 ) ;
3757} ;
@@ -40,10 +60,16 @@ const Component = () => {
4060 const { isModalOpen, openModal, closeModal } = useModal ( ) ;
4161
4262 return (
43- < div style = { { padding : '2rem' } } >
44- < h1 className = "rsm-mb-4 rsm-text-2xl" > React Simple Modal Example</ h1 >
63+ < div className = "p-8" >
64+ < h1 className = "mb-4 text-2xl" > React Simple Modal Example</ h1 >
65+ < a
66+ className = "block mb-4 hover:text-blue-700"
67+ href = "https://github.com/mbrookson/react-simple-hook-modal"
68+ >
69+ https://github.com/mbrookson/react-simple-hook-modal
70+ </ a >
4571 < button
46- className = "rsm- p-3 rsm- bg-blue-500 rsm- text-white rsm- rounded"
72+ className = "p-3 bg-blue-500 text-white rounded"
4773 onClick = { openModal }
4874 >
4975 Open modal
0 commit comments