Skip to content
This repository was archived by the owner on Feb 16, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ export default ({
compact,
secondary,
tertiary,
iconOnly
iconOnly,
...rest
}) => (
<button
onClick={onClick}
className={cn({ small, compact, secondary, tertiary, iconOnly })}
{...rest}
>
{children}
<style jsx>{`
Expand Down
14 changes: 9 additions & 5 deletions src/components/header/header.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { useState, useEffect } from "react";
import cn from "classnames";
import { User } from "react-feather";

import Link from "../link";
import Logo from "../logo";
import Button from "../button";
import { User } from "react-feather";
import Toggle from "./toggle";

export default () => {
Expand All @@ -20,10 +22,12 @@ export default () => {
<Logo />
<nav className={cn({ active })}>
<Toggle />
<Button small tertiary>
<User size={21} />
Belépés
</Button>
<Link underline={false} href="/api/v1/login/authsch">
<Button small tertiary>
<User size={21} />
Belépés
</Button>
</Link>
</nav>
<button
onClick={() => toggleMenu()}
Expand Down
23 changes: 23 additions & 0 deletions src/components/textfield.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default props => (
<>
<input {...props} type="text" />
<style jsx>
{`
input {
background: var(--accents-3);
color: var(--fg);
border: 2px solid var(--accents-3);
padding: var(--gap);
transition: all var(--transition);
-webkit-appearance: none;
border-radius: 0;
}

input:focus {
outline: 0;
border-color: var(--fg);
}
`}
</style>
</>
);
57 changes: 57 additions & 0 deletions src/pages/first-login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { useState } from "react";
import Router from "next/router";

import Button from "../components/button";
import TextField from "../components/textfield";

// TODO error handling
// TODO redirect if user is logged in

export default () => {
const [text, setText] = useState("");

function handleSubmit (e) {
e.preventDefault();
(async function setDisplayName () {
await fetch("/api/v1/auth/display-name/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ displayName: text })
});
Router.push("/");
})();
}
return (
<main className="container">
<h1>Kérlek, válassz magadnak felhasználónevet</h1>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Itt nem felhasználó nevet kellene használni, hanem a "display name"-nek valamilyen magyar fordítását.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Várom a tippeket :P

Amúgy mindenhol a display name fogja (egyértelműen) azonosítani az embereket, szóval sztem nevezhetjük username-nek. Ez egy változtatható username.

<form onSubmit={handleSubmit}>
<TextField
value={text}
autoFocus
onChange={e => setText(e.target.value)}
/>
<Button type="submit">Tovább</Button>
</form>

<style jsx>{`
.container {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

h1 {
font-size: 16px;
font-weight: 400;
text-align: center;
}

form > :global(input) {
margin-right: var(--gap-half);
}
`}</style>
</main>
);
};