screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <script src="https://unpkg.com/react@17.0.2/umd/react.development.js"></script> <script src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js"></script> <script src="https://unpkg.com/@babel/standalone@7.14.7/babel.min.js"></script> </head> <body> <div id="app"></div> <script type="text/babel"> const { useState } = React; function App() { const [inputText, setInputText] = useState(''); const isUppercase = /^[A-Z]/.test(inputText); return ( <div className='container'> <input type="text" placeholder="Enter a string" onChange={(e) => setInputText(e.target.value)} className="input-element" /> <p className="paragraph-element">Is the first letter uppercase? {isUppercase ? 'Yes' : 'No'}</p> </div> ); } ReactDOM.render(<App />, document.getElementById("app")); </script> <style> .container { font-family: Arial, sans-serif; padding: 20px; border-radius: 5px; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2); max-width: 600px; margin: 0 auto; text-align: center; } .input-element { padding: 10px; border: 2px solid #ccc; border-radius: 5px; width: 300px; font-size: 16px; margin-bottom: 20px; text-align: center; } .input-element::placeholder { color: #aaa; } .paragraph-element { font-size: 20px; color: #333; text-align: center; } /* Style for the "Yes" and "No" text */ .paragraph-element::before { content: 'Is the first letter uppercase? '; font-weight: bold; } .paragraph-element::after { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 5px; } /* Styling for the "Yes" and "No" indicator */ .paragraph-element::after { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 5px; } .paragraph-element::after { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 5px; } /* Styling for the "Yes" and "No" indicator based on the state */ .paragraph-element::after { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 5px; background-color: #5ab45e; /* Green for "Yes" */ } .paragraph-element::before { content: 'Is the first letter uppercase? '; font-weight: bold; } .paragraph-element::after { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 5px; background-color: #f44336; /* Red for "No" */ } </style> </body> </html>