Skip to content

Commit 22b8eb2

Browse files
feat: add responsive header (#33)
Co-authored-by: Stephan Meijer <[email protected]>
1 parent 41de07c commit 22b8eb2

File tree

3 files changed

+36
-19
lines changed

3 files changed

+36
-19
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Testing-Playground ([demo][playground])
22

33
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
4+
45
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
6+
57
<!-- ALL-CONTRIBUTORS-BADGE:END -->
68

79
**Playground for [testing-library/dom]**
@@ -103,6 +105,7 @@ Thanks goes to these people ([emoji key][emojis]):
103105

104106
<!-- markdownlint-enable -->
105107
<!-- prettier-ignore-end -->
108+
106109
<!-- ALL-CONTRIBUTORS-LIST:END -->
107110

108111
This project follows the [all-contributors][all-contributors] specification.

src/components/Header.js

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,42 @@ const headerLinks = [
1010

1111
function Header() {
1212
return (
13-
<nav className="flex items-center justify-between bg-gray-900 px-8 text-white w-full h-full">
14-
<div className="flex items-center flex-shrink-0 text-white">
15-
<a className="title" href="/">
16-
<h1 className="font-light text-xl tracking-tight flex space-x-4 items-center justify-start">
17-
<img width={24} height={24} src={icon} />{' '}
18-
<span>Testing Playground</span>
19-
</h1>
20-
</a>
21-
</div>
13+
<nav className="text-white w-full h-20 md:h-16">
14+
<div className="flex items-center justify-between bg-gray-900 px-8 h-10 md:h-16">
15+
<div className="flex items-center flex-shrink-0 text-white">
16+
<a className="title" href="/">
17+
<h1 className="font-light text-xl tracking-tight flex space-x-4 items-center justify-start">
18+
<img width={24} height={24} src={icon} />{' '}
19+
<span>Testing Playground</span>
20+
</h1>
21+
</a>
22+
</div>
23+
24+
<div className="flex items-center space-x-8">
25+
<a
26+
href="https://github.com/smeijer/testing-playground"
27+
className="hover:underline"
28+
>
29+
GitHub
30+
</a>
31+
32+
<div className="border-r border-gray-600 mx-4 h-8 hidden md:block" />
2233

23-
<div>
24-
<a
25-
href="https://github.com/smeijer/testing-playground"
26-
className="hover:underline"
27-
>
28-
GitHub
29-
</a>
34+
{headerLinks.map((x) => (
35+
<a
36+
className="hover:underline hidden md:block"
37+
key={x.title}
38+
href={x.url}
39+
>
40+
{x.title}
41+
</a>
42+
))}
43+
</div>
3044
</div>
3145

32-
<div className="flex space-x-8">
46+
<div className="flex justify-between sm:justify-end items-center bg-gray-800 px-8 h-10 md:hidden space-x-8">
3347
{headerLinks.map((x) => (
34-
<a className="hover:underline" key={x.title} href={x.url}>
48+
<a className="hover:underline truncate" key={x.title} href={x.url}>
3549
{x.title}
3650
</a>
3751
))}

src/components/Layout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Footer from './Footer';
55
function Layout({ children }) {
66
return (
77
<div className="flex flex-col h-screen">
8-
<div className="h-16 mb-8 flex-none">
8+
<div className="mb-8 flex-none">
99
<Header />
1010
</div>
1111

0 commit comments

Comments
 (0)