1import React, { useContext } from "react";
2import styled from "styled-components";
3
4import { AuthenticationForm } from "../AuthenticationForm";
5import { PageContext } from "../Page";
6
7export default function Header() {
8 const context = useContext(PageContext);
9 const error = context?.error;
10
11 return (
12 <StyledHeader>
13 <h1>Sesame Labs Coding Assignment</h1>
14 <ErrorContainer>{error || ""}</ErrorContainer>
15 <div>
16 <AuthenticationForm />
17 </div>
18 </StyledHeader>
19 );
20}
21
22const StyledHeader = styled.div`
23 width: 100%;
24 height: 60px;
25 display: grid;
26 grid-template-columns: 400px 1fr 200px;
27 column-gap: auto;
28
29 > * {
30 padding: 0.5em 0;
31 }
32
33 > h1 {
34 margin: 0;
35 font-size: 1.5em;
36 }
37
38 > :last-child {
39 display: flex;
40 justify-content: right;
41 }
42`;
43
44const ErrorContainer = styled.div`
45 color: red;
46`;