mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
4b66771895
The `legacyBehavior` prop of the `Link` component has been deprecated since #77473. For Next.js 16, we're finally removing support for it. Consequently, we're also removing support for the `passHref` prop, which was only useful in conjunction with the `legacyBehavior` prop. A [codemod is available](https://nextjs.org/docs/app/guides/upgrading/codemods#new-link) to help you automatically upgrade your codebase. reverts #77473 --------- Co-authored-by: Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
79 lines
1.7 KiB
JavaScript
79 lines
1.7 KiB
JavaScript
import Link from "next/link";
|
|
|
|
const Form = ({ isLogin, errorMessage, onSubmit }) => (
|
|
<form onSubmit={onSubmit}>
|
|
<label>
|
|
<span>Username</span>
|
|
<input type="text" name="username" required />
|
|
</label>
|
|
<label>
|
|
<span>Password</span>
|
|
<input type="password" name="password" required />
|
|
</label>
|
|
{!isLogin && (
|
|
<label>
|
|
<span>Repeat password</span>
|
|
<input type="password" name="rpassword" required />
|
|
</label>
|
|
)}
|
|
|
|
<div className="submit">
|
|
{isLogin ? (
|
|
<>
|
|
<Link href="/signup">I don't have an account</Link>
|
|
<button type="submit">Login</button>
|
|
</>
|
|
) : (
|
|
<>
|
|
<Link href="/login">I already have an account</Link>
|
|
<button type="submit">Signup</button>
|
|
</>
|
|
)}
|
|
</div>
|
|
|
|
{errorMessage && <p className="error">{errorMessage}</p>}
|
|
|
|
<style jsx>{`
|
|
form,
|
|
label {
|
|
display: flex;
|
|
flex-flow: column;
|
|
}
|
|
label > span {
|
|
font-weight: 600;
|
|
}
|
|
input {
|
|
padding: 8px;
|
|
margin: 0.3rem 0 1rem;
|
|
border: 1px solid #ccc;
|
|
border-radius: 4px;
|
|
}
|
|
.submit {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
.submit > a {
|
|
text-decoration: none;
|
|
}
|
|
.submit > button {
|
|
padding: 0.5rem 1rem;
|
|
cursor: pointer;
|
|
background: #fff;
|
|
border: 1px solid #ccc;
|
|
border-radius: 4px;
|
|
}
|
|
.submit > button:hover {
|
|
border-color: #888;
|
|
}
|
|
.error {
|
|
color: brown;
|
|
margin: 1rem 0 0;
|
|
}
|
|
`}</style>
|
|
</form>
|
|
);
|
|
|
|
export default Form;
|