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 [input, setInput] = useState('Font aweosme icons'); const isFirstLetterUppercase = input.length > 0 && input[0] === input[0].toUpperCase(); const showAlert = () => { const message = isFirstLetterUppercase ? 'The first letter is uppercase.' : 'The first letter is not uppercase.'; alert(message); }; return ( <div className='container'> <h3>React Js Check First Letter Of String Is Uppercase </h3> <input className='input-field' type="text" value={input} onChange={(e) => setInput(e.target.value)} placeholder="Enter a string" /> <button className='check-button' onClick={showAlert}>Check Uppercase</button> </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-field { padding: 10px; border: 2px solid #007BFF; /* Blue border */ border-radius: 5px; margin-bottom: 10px; font-size: 16px; width: 300px; outline: none; } .check-button { background-color: #007BFF; /* Blue background */ color: white; border: none; border-radius: 5px; padding: 10px 20px; cursor: pointer; font-size: 16px; transition: background-color 0.3s; } .check-button:hover { background-color: #0056b3; /* Darker blue on hover */ } </style> </body> </html>