screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.2/umd/react.development.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.2/umd/react-dom.development.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script> </head> <body> <div id="app"></div> <script type="text/babel"> const { useState } = React; function App() { const [isModalOpen, setIsModalOpen] = useState(false); const openModal = () => { setIsModalOpen(true); }; const closeModal = () => { setIsModalOpen(false); }; const save = () => { alert('Successfully Saved'); setIsModalOpen(false); }; return ( <div className="container"> <h3>React Js Fullscreen Modal Dialog</h3> <button className="modal-button" onClick={openModal}> Open Modal </button> <div className={`fullscreen-modal ${isModalOpen ? 'open' : ''}`}> <span className="top-close-button" onClick={closeModal}> ✕ </span> <h2 className="modal-title">React Js Fullscreen Modal Content</h2> <p className="modal-text">This is the content of the fullscreen modal.</p> <div className="modal-action"> <button className="bottom-close-button" onClick={closeModal}> Close </button> <button className="save-button" onClick={save}> Save </button> </div> </div> </div> ); } ReactDOM.render(<App />, document.getElementById('app')); </script> <style> body { background-color: #f1f1f1; } .container { text-align: center; width: 600px; margin: 0 auto; padding: 20px; } /* Modal button styles */ .modal-button { padding: 10px 20px; font-size: 16px; background-color: #007BFF; color: #fff; border: none; cursor: pointer; border-radius: 5px; outline: none; } /* Fullscreen Modal Styles */ .fullscreen-modal { position: fixed; bottom: -100%; /* Start the modal below the screen */ left: 0; width: 100%; height: 100%; background-color: #fff; z-index: 999; overflow: hidden; transition: bottom 0.5s ease-in-out; /* Add transition here */ } /* Modal open styles */ .fullscreen-modal.open { bottom: 0; /* Show the modal by moving it to the top */ } /* Close button at the top right corner */ .top-close-button { position: absolute; top: 10px; right: 25px; font-size: 24px; color: #888; cursor: pointer; } /* Modal title */ .modal-title { font-size: 24px; margin-top: 20px; color: #333; } /* Modal text */ .modal-text { font-size: 18px; margin-top: 10px; color: #666; } /* Modal action buttons */ .modal-action { position: absolute; bottom: 10px; right: 25px; } /* Close button at the bottom */ .bottom-close-button { padding: 10px 20px; font-size: 16px; background-color: #ddd; color: #333; border: none; border-radius: 5px; cursor: pointer; margin-right: 10px; } /* Save button */ .save-button { padding: 10px 20px; font-size: 16px; background-color: #007BFF; color: #fff; border: none; border-radius: 5px; cursor: pointer; } </style> </body> </html>