Files
StevenandGitHub 4466ba436b chore(examples): use default prettier for examples/templates (#60530)
## Description
This PR ensures that the default prettier config is used for examples
and templates.

This config is compatible with `prettier@3` as well (upgrading prettier
is bigger change that can be a future PR).

## Changes
- Updated `.prettierrc.json` in root with `"trailingComma": "es5"` (will
be needed upgrading to prettier@3)
- Added `examples/.prettierrc.json` with default config (this will
change every example)
- Added `packages/create-next-app/templates/.prettierrc.json` with
default config (this will change every template)

## Related

- Fixes #54402
- Closes #54409
2024-01-11 16:01:44 -07:00

58 lines
1.2 KiB
JavaScript

import { useUser } from "../lib/hooks";
import Layout from "../components/layout";
const Home = () => {
const user = useUser();
return (
<Layout>
<h1>Magic Example</h1>
<p>Steps to test this authentication example:</p>
<ol>
<li>Click Login and enter an email.</li>
<li>
You'll be redirected to Home. Click on Profile, notice how your
session is being used through a token stored in a cookie.
</li>
<li>
Click Logout and try to go to Profile again. You'll get redirected to
Login.
</li>
</ol>
<p>
To learn more about Magic, visit their{" "}
<a
href="https://docs.magic.link/"
target="_blank"
rel="noopener noreferrer"
>
documentation
</a>
.
</p>
{user && (
<>
<p>Currently logged in as:</p>
<pre>{JSON.stringify(user, null, 2)}</pre>
</>
)}
<style jsx>{`
li {
margin-bottom: 0.5rem;
}
pre {
white-space: pre-wrap;
word-wrap: break-word;
}
`}</style>
</Layout>
);
};
export default Home;