aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/HeaderBar/index.tsx
blob: 5c536ef2901ed3a2f29f4b94221459438fbdd30a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/** @jsx jsx */
import { jsx, css } from "@emotion/react";

import Header1 from "./header_1.svg";
import Header2 from "./header_2.svg";
import Logo from "./logo.svg";

import { Link } from "react-router-dom";

interface HeaderBarProps {
    title?: string
    description?: string
}

const headerImageStyles = css`
  * {
    z-index: -1;
    top: 0;
    position: absolute;
    width: 100%;
    transition: height 1s;
  }
`;

const headerTextStyles = css`
  transition: margin 1s;
  font-family: "Uni Sans", "Hind", "Arial", sans-serif;

  margin: 0 2rem 10rem 2rem;

  .title {
    font-size: 3vmax;
    margin-bottom: 0;
  }

  .full_size {
    line-height: 200%;
  }

  .description {
    font-size: 1.5vmax;
  }

  .title, .description {
    transition: font-size 1s;
  }

  @media (max-width: 480px) {
    margin-top: 7rem;
    text-align: center;

    .title {
      font-size: 5vmax;
    }

    .full_size {
      line-height: 100%;
    }

    .description {
      font-size: 2vmax;
    }
  }
`;

const homeButtonStyles = css`
  svg {
    transform: scale(0.25);
    transition: top 300ms, transform 300ms;

    @media (max-width: 480px) {
      transform: scale(0.15);
    }
  }

  * {
    position: absolute;
    top: -10rem;
    right: 1rem;

    z-index: 0;
    transform-origin: right;

    @media (max-width: 700px) {
      top: -11.5rem;
    }

    @media (max-width: 480px) {
      top: -12.5rem;
    }
  }
`;

function HeaderBar({ title, description }: HeaderBarProps): JSX.Element {
    if (!title) {
        title = "Python Discord Forms";
    }

    return (
        <div>
            <div css={headerImageStyles}>
                <Header1/>
                <Header2/>
            </div>

            <div css={css`${headerTextStyles}; margin-bottom: 12.5%;`}>
                <h1 className={description ? "title" : "title full_size"}>{title}</h1>
                {description ? <h1 className="description">{description}</h1> : null}
            </div>

            <Link to="/" css={homeButtonStyles}>
                <Logo/>
            </Link>
        </div>
    );
}

export default HeaderBar;