Skip to content

Commit 2152399

Browse files
committed
Make header responsive.
1 parent 7166bb9 commit 2152399

File tree

8 files changed

+117
-54
lines changed

8 files changed

+117
-54
lines changed

package-lock.json

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"gatsby-transformer-remark": "^4.8.0",
3232
"normalize.css": "^8.0.1",
3333
"react": "^17.0.2",
34-
"react-dom": "^17.0.2"
34+
"react-dom": "^17.0.2",
35+
"styled-breakpoints": "^10.0.1"
3536
},
3637
"devDependencies": {
3738
"@types/styled-components": "^5.1.12",

src/components/Header.styles.ts

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,60 @@
1+
import { up } from 'styled-breakpoints'
12
import styled from 'styled-components'
23

34
import { $theme } from '../styles/theme'
5+
46
import { Link } from './Link'
57

68
export const Container = styled.header`
79
display: grid;
810
grid-template-columns: auto 1fr;
11+
row-gap: 1rem;
912
align-items: center;
1013
margin: 2rem 0;
1114
`
1215

13-
export const Brand = styled(Link)`
16+
export const Brand = styled.div`
17+
grid-row: 1;
18+
grid-column: 1 / 3;
19+
display: grid;
20+
justify-content: center;
21+
22+
${up('tablet')} {
23+
grid-column: 1 / 1;
24+
}
25+
`
26+
27+
export const BrandLink = styled(Link)`
1428
color: ${$theme.color.copy};
1529
text-decoration: none;
1630
font-weight: ${$theme.fontWeight.black};
1731
font-size: ${$theme.fontSize.l2.rem}rem;
1832
line-height: 1.25em;
19-
grid-column: 1;
2033
margin: 0;
21-
`
2234
23-
export const BrandFirstLetter = styled.span`
24-
display: inline-block;
25-
width: 1.25em;
26-
height: 1.25em;
27-
margin-right: 0.05em;
28-
background-color: ${$theme.color.copy};
29-
color: ${$theme.color.background};
30-
text-align: center;
31-
border-radius: 1px;
35+
> span {
36+
display: inline-block;
37+
width: 1.25em;
38+
height: 1.25em;
39+
margin-right: 0.05em;
40+
background-color: ${$theme.color.copy};
41+
color: ${$theme.color.background};
42+
text-align: center;
43+
border-radius: 1px;
44+
}
3245
`
3346

3447
export const Nav = styled.nav`
35-
grid-column: 2;
48+
grid-row: 2;
49+
grid-column: 1 / 3;
3650
display: grid;
37-
justify-content: end;
51+
justify-content: center;
52+
53+
${up('tablet')} {
54+
grid-row: 1;
55+
grid-column: 2;
56+
justify-content: end;
57+
}
3858
`
3959

4060
export const NavMenu = styled.ul`

src/components/Header.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import { Link } from './Link'
66
export const Header = () => {
77
return (
88
<S.Container>
9-
<S.Brand to="/">
10-
<S.BrandFirstLetter>M</S.BrandFirstLetter>ariuzzo
9+
<S.Brand>
10+
<S.BrandLink to="/">
11+
<span>M</span>ariuzzo
12+
</S.BrandLink>
1113
</S.Brand>
1214
<S.Nav>
1315
<S.NavMenu>

src/components/Typography.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export const PageTitle = styled.h1`
2929

3030
export const TextBlock = styled.div`
3131
color: ${$theme.color.copy};
32-
margin: 3rem 0;
3332
font-size: ${$theme.fontSize.copy1.rem}rem;
3433
font-weight: ${$theme.fontWeight.regular};
3534
line-height: 1.5;
@@ -51,4 +50,8 @@ export const TextBlock = styled.div`
5150
strong {
5251
font-weight: ${$theme.fontWeight.black};
5352
}
53+
54+
pre {
55+
overflow-x: auto;
56+
}
5457
`

src/pages/about.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const AboutPage: React.FC = () => {
4646
</p>
4747
<ul>
4848
<li>
49-
<strong>JavaScript</strong> since 2006, using NodeJS, React and
49+
<strong>JavaScript</strong> since 2006. Now using NodeJS, React and
5050
Redux.
5151
</li>
5252
<li>

0 commit comments

Comments
 (0)