Skip to content

Commit d7ed9a4

Browse files
committed
Contactus accessibility, container id, import header, change form's label position
1 parent 1b67211 commit d7ed9a4

File tree

8 files changed

+219
-18
lines changed

8 files changed

+219
-18
lines changed

src/components/contact-us/index.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,20 @@ import './index.css';
77

88
export default props => {
99
return (
10-
<Container className="ContactUs" size="medium">
10+
<Container className="ContactUs" size="small" id="contactus">
1111
<h1>Contact us</h1>
12-
<Container size="small">
13-
<p>
14-
If you like{' '}
15-
<span role="img" aria-label="pizza">
16-
🍕
17-
</span>{' '}
18-
and{' '}
19-
<span role="img" aria-label="python">
20-
🐍
21-
</span>
22-
, get in touch! We are always looking for new places!
23-
</p>
24-
<Form />
25-
</Container>
12+
<p>
13+
If you like{' '}
14+
<span role="img" aria-label="pizza">
15+
🍕
16+
</span>{' '}
17+
and{' '}
18+
<span role="img" aria-label="python">
19+
🐍
20+
</span>
21+
, get in touch! We are always looking for new places!
22+
</p>
23+
<Form />
2624
</Container>
2725
);
2826
};

src/components/container/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import classnames from 'classnames';
44
import './index.css';
55

66
export default props => {
7-
const { size, children, className } = props;
7+
const { size, children, id, className } = props;
88

99
return (
10-
<div className={classnames('Container', `Container--${size}`, className)}>
10+
<div
11+
className={classnames('Container', `Container--${size}`, className)}
12+
id={id}
13+
>
1114
{children}
1215
</div>
1316
);

src/components/header/index.css

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
.Header {
2+
position: absolute;
3+
top: 0;
4+
left: 0;
5+
width: 100%;
6+
z-index: 1;
7+
8+
.Container {
9+
display: flex;
10+
justify-content: space-between;
11+
flex-direction: column;
12+
align-items: center;
13+
padding-top: 1rem;
14+
15+
@media (--tablet) {
16+
flex-direction: row;
17+
}
18+
}
19+
20+
&--logo {
21+
width: 10rem;
22+
height: 10rem;
23+
}
24+
25+
&--links {
26+
display: flex;
27+
align-items: center;
28+
flex-wrap: wrap;
29+
flex-direction: column;
30+
margin-top: 1rem;
31+
letter-spacing: 0.1em;
32+
33+
@media (--mobile) {
34+
flex-direction: row;
35+
flex-wrap: nowrap;
36+
}
37+
38+
@media (--tablet) {
39+
margin-top: 0;
40+
}
41+
42+
li {
43+
font-family: var(--font-name--paragraph);
44+
font-weight: 700;
45+
46+
a {
47+
display: block;
48+
padding: 0.4rem;
49+
color: var(--white);
50+
user-select: none;
51+
background: linear-gradient(
52+
to top,
53+
var(--white) 0.2rem,
54+
transparent 0.2rem
55+
)
56+
no-repeat center;
57+
background-size: 0% 100%;
58+
transition: background-size 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
59+
60+
&:hover,
61+
&:active {
62+
background-size: 100% 100%;
63+
}
64+
}
65+
66+
& + li {
67+
margin-top: 2rem;
68+
69+
@media (--mobile) {
70+
margin-top: 0;
71+
margin-left: 2rem;
72+
}
73+
}
74+
75+
&:last-child {
76+
perspective: 24rem;
77+
78+
a {
79+
padding: 1rem 2.4rem;
80+
border: 1px solid var(--white);
81+
border-radius: 10rem;
82+
background: var(--white);
83+
color: var(--primary-color);
84+
transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1),
85+
box-shadow 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
86+
87+
&:hover,
88+
&:active {
89+
transform: translateZ(2.6rem) rotateX(-12deg) rotateY(-10deg);
90+
box-shadow: 0.6rem 0.4rem 2.4rem -0.8rem rgba(25, 0, 0, 0.5);
91+
}
92+
}
93+
}
94+
}
95+
}
96+
}

src/components/header/index.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import React, { Component } from 'react';
2+
3+
import Container from '../container';
4+
import Logo from '../logo';
5+
6+
import './index.css';
7+
8+
export default class Header extends Component {
9+
onNavClick(e) {
10+
e.preventDefault();
11+
12+
const target = e.target;
13+
const destinationId = target.getAttribute('data-destination');
14+
const destinationDom = window.document.querySelector(`#${destinationId}`);
15+
16+
if (!destinationDom) {
17+
return;
18+
}
19+
20+
window.scrollTo({
21+
top: destinationDom.offsetTop,
22+
behavior: 'smooth',
23+
});
24+
}
25+
26+
render() {
27+
return (
28+
<div className="Header">
29+
<Container size="large">
30+
<Logo />
31+
<ul className="Header--links">
32+
<li>
33+
<a
34+
onClick={this.onNavClick}
35+
href="#past-events"
36+
data-destination="past-events"
37+
>
38+
Past events
39+
</a>
40+
</li>
41+
<li>
42+
<a
43+
onClick={this.onNavClick}
44+
href="#contactus"
45+
data-destination="contactus"
46+
>
47+
Contact us
48+
</a>
49+
</li>
50+
<li>
51+
<a
52+
href="https://hamburg.python.pizza?ref=global-header"
53+
target="_blank"
54+
rel="noopener noreferrer"
55+
>
56+
Hamburg
57+
</a>
58+
</li>
59+
</ul>
60+
</Container>
61+
</div>
62+
);
63+
}
64+
}

src/components/logo/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.Logo {
2+
width: 10rem;
3+
height: 10rem;
4+
}

src/components/logo/index.js

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/past-events/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default props => {
2727
);
2828

2929
return (
30-
<Container className="PastEvents" size="large">
30+
<Container className="PastEvents" size="large" id="past-events">
3131
<h1>Our past events</h1>
3232

3333
<div className="PastEvents--list">

src/pages/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import React from 'react';
22

33
import Layout from '../components/layout';
44
import SEO from '../components/seo';
5+
import Header from '../components/header';
56
import Hero from '../components/hero';
67
import PastEvents from '../components/past-events';
78
import ContactUs from '../components/contact-us';
89

910
export default props => (
1011
<Layout>
1112
<SEO title="Home" />
13+
<Header />
1214
<Hero />
1315
<PastEvents />
1416
<ContactUs />

0 commit comments

Comments
 (0)