Unknown model· unknown
from ShareGPT 90K (shared ChatGPT conversations)
create me a single page app that has a login feature with react. make it have responsive…
- User
create me a single page app that has a login feature with react. make it have responsive design for web, mobile and ipad
- Assistant
Here is a simple code for a single page login app with responsive design in React. You will need to have React, React Router and Material-UI installed.
cppimport React, { useState } from "react"; import { Container, CssBaseline, Avatar, Typography, TextField, Button, Grid, makeStyles, Link, } from "@material-ui/core"; import LockOutlinedIcon from "@material-ui/icons/LockOutlined"; import { useHistory } from "react-router-dom"; const useStyles = makeStyles((theme) => ({ paper: { marginTop: theme.spacing(8), display: "flex", flexDirection: "column", alignItems: "center", }, avatar: { margin: theme.spacing(1), backgroundColor: theme.palette.secondary.main, }, form: { width: "100%", // Fix IE 11 issue. marginTop: theme.spacing(1), }, submit: { margin: theme.spacing(3, 0, 2), }, })); export default function Login() { const classes = useStyles(); const history = useHistory(); const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); const handleSubmit = (event) => { event.preventDefault(); // handle authentication logic if (username === "admin" && password === "password") { // redirect to home page history.push("/"); } }; return ( <Container component="main" maxWidth="xs"> <CssBaseline /> <div className={classes.paper}> <Avatar className={classes.avatar}> <LockOutlinedIcon /> </Avatar> <Typography component="h1" variant="h5"> Sign in </Typography> <form className={classes.form} noValidate onSubmit={handleSubmit}> <TextField variant="outlined" margin="normal" required fullWidth id="username" label="Username" name="username" autoComplete="username" autoFocus value={username} onChange={(e) => setUsername(e.target.value)} /> <TextField variant="outlined" margin="normal" required fullWidth name="password" label="Password" type="password" id="password" autoComplete="current-password" value={password} onChange={(e) => setPassword(e.target.value)} /> <Button type="submit" fullWidth variant="contained" color="primary" className={classes.submit} > Sign In </Button> <Grid container> <Grid item xs> <Link href="#" variant="body2"> Forgot password? </Link - User
Can you output this as an HTML file that I can open in my browser
- Assistant
Here is the HTML file version of the React code:
php
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.