Skip to content

Commit 9a07345

Browse files
committed
Merge branch 'master' into develop
2 parents 78a0a2a + d711b3e commit 9a07345

File tree

10 files changed

+81
-64
lines changed

10 files changed

+81
-64
lines changed

components/languages.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { Locale } from 'i18n';
22
import styled from 'styled-components';
33
import { useRouter } from 'next/dist/client/router';
44

5+
import * as gtag from 'lib/gtag';
6+
57
const Container = styled.div`
68
top: 0;
79
right: 1rem;
@@ -26,10 +28,15 @@ const Container = styled.div`
2628
`;
2729

2830
export function Languages() {
29-
const { locales, push } = useRouter();
31+
const { locales, push, pathname } = useRouter();
3032

3133
const handleLocaleClick = (locale: Locale) => () => {
32-
push('/', '/', { locale });
34+
gtag.event({
35+
action: 'i18n_click',
36+
category: 'Locale',
37+
label: locale,
38+
});
39+
push(pathname, pathname, { locale });
3340
};
3441

3542
return (

components/template.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { GlobalStyles } from 'styles/globals';
55
import styled, { ThemeProvider } from 'styled-components';
66
import { tokens } from 'styles/theme';
77
import { FlexColumnCentered } from 'styles/extends';
8+
import { Languages } from './languages';
89

910
const Page = styled.section`
1011
padding: 2rem;
@@ -35,8 +36,9 @@ export function PageTemplate({ t, title, children }: PageTemplateProps) {
3536
<GlobalStyles />
3637
<Head>
3738
<title>{title}</title>
38-
<link rel="icon" href="/favicon.ico" />
39+
<link rel="icon" href="/favicon.png" />
3940
</Head>
41+
<Languages />
4042
<Main>{children}</Main>
4143
<Footer>
4244
<a href="/"> {t('author')} ©.</a> {t('footer')}

i18n/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ const portuguese = {
66
...common,
77
welcome: 'Olá 👋, eu sou Luis Takahashi',
88
bio:
9-
'Um apaixonado entusiasta de Typecript e engenheiro de software frontend do Brasil',
9+
'Um entusiasta apaixonado por Typecript e engenheiro de software frontend do Brasil',
1010
footer: 'Todos os direitos reservados',
11+
backtohome: 'Ir a página inicial 🏡',
12+
404: 'Ops esta página não foi encontrada.',
1113
};
1214

1315
const english = {
@@ -16,6 +18,8 @@ const english = {
1618
bio:
1719
'A passionate Typescript enthusiast and frontend software engineer from Brazil',
1820
footer: 'All rights reserved',
21+
backtohome: 'Go to home page 🏡',
22+
404: 'Ops this page could not be found.',
1923
};
2024

2125
const locales = {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@
3939
"prettier": "^2.1.2",
4040
"typescript": "^4.1.0-beta"
4141
}
42-
}
42+
}

pages/404.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { NextPage } from 'next';
2+
import Link from 'next/link';
3+
import { Translate } from 'i18n';
4+
import { PageTemplate } from 'components/template';
5+
6+
type NotFoundProps = {
7+
t: Translate;
8+
};
9+
const NotFound: NextPage<NotFoundProps> = ({ t }) => (
10+
<PageTemplate t={t} title={t(404)}>
11+
<h1>🤔 404</h1>
12+
<p>{t(404)}</p>
13+
<Link href="/">{t('backtohome')}</Link>
14+
</PageTemplate>
15+
);
16+
17+
export default NotFound;

pages/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { PageTemplate } from 'components/template';
55
import styled from 'styled-components';
66

77
import * as gtag from 'lib/gtag';
8-
import { Languages } from 'components/languages';
98

109
const Image = styled(NextImage)`
1110
border-radius: 50%;
@@ -68,7 +67,6 @@ const Home: NextPage<HomeProps> = ({ t }) => (
6867
<PageTemplate t={t} title={t('author')}>
6968
<h1>{t('welcome')}</h1>
7069
<p>{t('bio')}</p>
71-
<Languages />
7270
<Image
7371
src="/takah.jpg"
7472
alt="Picture of the author"

public/favicon.ico

-14.7 KB
Binary file not shown.

public/favicon.png

1.76 KB
Loading

tsconfig.json

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
{
22
"compilerOptions": {
33
"target": "es5",
4-
"lib": [
5-
"dom",
6-
"dom.iterable",
7-
"esnext"
8-
],
4+
"lib": ["dom", "dom.iterable", "esnext"],
95
"allowJs": true,
106
"skipLibCheck": true,
117
"strict": false,
@@ -17,15 +13,8 @@
1713
"resolveJsonModule": true,
1814
"isolatedModules": true,
1915
"jsx": "preserve",
20-
"baseUrl": ".",
16+
"baseUrl": "."
2117
},
22-
"include": [
23-
"next-env.d.ts",
24-
"**/*.ts",
25-
"**/*.tsx",
26-
"next.config.js"
27-
],
28-
"exclude": [
29-
"node_modules"
30-
],
18+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "next.config.js"],
19+
"exclude": ["node_modules"]
3120
}

yarn.lock

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,73 +1255,73 @@
12551255
csstype "^3.0.2"
12561256

12571257
"@typescript-eslint/eslint-plugin@^4.6.0":
1258-
version "4.6.0"
1259-
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.6.0.tgz#210cd538bb703f883aff81d3996961f5dba31fdb"
1260-
integrity sha512-1+419X+Ynijytr1iWI+/IcX/kJryc78YNpdaXR1aRO1sU3bC0vZrIAF1tIX7rudVI84W7o7M4zo5p1aVt70fAg==
1258+
version "4.6.1"
1259+
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.6.1.tgz#99d77eb7a016fd5a5e749d2c44a7e4c317eb7da3"
1260+
integrity sha512-SNZyflefTMK2JyrPfFFzzoy2asLmZvZJ6+/L5cIqg4HfKGiW2Gr1Go1OyEVqne/U4QwmoasuMwppoBHWBWF2nA==
12611261
dependencies:
1262-
"@typescript-eslint/experimental-utils" "4.6.0"
1263-
"@typescript-eslint/scope-manager" "4.6.0"
1262+
"@typescript-eslint/experimental-utils" "4.6.1"
1263+
"@typescript-eslint/scope-manager" "4.6.1"
12641264
debug "^4.1.1"
12651265
functional-red-black-tree "^1.0.1"
12661266
regexpp "^3.0.0"
12671267
semver "^7.3.2"
12681268
tsutils "^3.17.1"
12691269

1270-
"@typescript-eslint/experimental-utils@4.6.0":
1271-
version "4.6.0"
1272-
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.6.0.tgz#f750aef4dd8e5970b5c36084f0a5ca2f0db309a4"
1273-
integrity sha512-pnh6Beh2/4xjJVNL+keP49DFHk3orDHHFylSp3WEjtgW3y1U+6l+jNnJrGlbs6qhAz5z96aFmmbUyKhunXKvKw==
1270+
"@typescript-eslint/experimental-utils@4.6.1":
1271+
version "4.6.1"
1272+
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.6.1.tgz#a9c691dfd530a9570274fe68907c24c07a06c4aa"
1273+
integrity sha512-qyPqCFWlHZXkEBoV56UxHSoXW2qnTr4JrWVXOh3soBP3q0o7p4pUEMfInDwIa0dB/ypdtm7gLOS0hg0a73ijfg==
12741274
dependencies:
12751275
"@types/json-schema" "^7.0.3"
1276-
"@typescript-eslint/scope-manager" "4.6.0"
1277-
"@typescript-eslint/types" "4.6.0"
1278-
"@typescript-eslint/typescript-estree" "4.6.0"
1276+
"@typescript-eslint/scope-manager" "4.6.1"
1277+
"@typescript-eslint/types" "4.6.1"
1278+
"@typescript-eslint/typescript-estree" "4.6.1"
12791279
eslint-scope "^5.0.0"
12801280
eslint-utils "^2.0.0"
12811281

12821282
"@typescript-eslint/parser@^4.6.0":
1283-
version "4.6.0"
1284-
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.6.0.tgz#7e9ff7df2f21d5c8f65f17add3b99eeeec33199d"
1285-
integrity sha512-Dj6NJxBhbdbPSZ5DYsQqpR32MwujF772F2H3VojWU6iT4AqL4BKuoNWOPFCoSZvCcADDvQjDpa6OLDAaiZPz2Q==
1283+
version "4.6.1"
1284+
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.6.1.tgz#b801bff67b536ecc4a840ac9289ba2be57e02428"
1285+
integrity sha512-lScKRPt1wM9UwyKkGKyQDqf0bh6jm8DQ5iN37urRIXDm16GEv+HGEmum2Fc423xlk5NUOkOpfTnKZc/tqKZkDQ==
12861286
dependencies:
1287-
"@typescript-eslint/scope-manager" "4.6.0"
1288-
"@typescript-eslint/types" "4.6.0"
1289-
"@typescript-eslint/typescript-estree" "4.6.0"
1287+
"@typescript-eslint/scope-manager" "4.6.1"
1288+
"@typescript-eslint/types" "4.6.1"
1289+
"@typescript-eslint/typescript-estree" "4.6.1"
12901290
debug "^4.1.1"
12911291

1292-
"@typescript-eslint/scope-manager@4.6.0":
1293-
version "4.6.0"
1294-
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.6.0.tgz#b7d8b57fe354047a72dfb31881d9643092838662"
1295-
integrity sha512-uZx5KvStXP/lwrMrfQQwDNvh2ppiXzz5TmyTVHb+5TfZ3sUP7U1onlz3pjoWrK9konRyFe1czyxObWTly27Ang==
1292+
"@typescript-eslint/scope-manager@4.6.1":
1293+
version "4.6.1"
1294+
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.6.1.tgz#21872b91cbf7adfc7083f17b8041149148baf992"
1295+
integrity sha512-f95+80r6VdINYscJY1KDUEDcxZ3prAWHulL4qRDfNVD0I5QAVSGqFkwHERDoLYJJWmEAkUMdQVvx7/c2Hp+Bjg==
12961296
dependencies:
1297-
"@typescript-eslint/types" "4.6.0"
1298-
"@typescript-eslint/visitor-keys" "4.6.0"
1297+
"@typescript-eslint/types" "4.6.1"
1298+
"@typescript-eslint/visitor-keys" "4.6.1"
12991299

1300-
"@typescript-eslint/types@4.6.0":
1301-
version "4.6.0"
1302-
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.6.0.tgz#157ca925637fd53c193c6bf226a6c02b752dde2f"
1303-
integrity sha512-5FAgjqH68SfFG4UTtIFv+rqYJg0nLjfkjD0iv+5O27a0xEeNZ5rZNDvFGZDizlCD1Ifj7MAbSW2DPMrf0E9zjA==
1300+
"@typescript-eslint/types@4.6.1":
1301+
version "4.6.1"
1302+
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.6.1.tgz#d3ad7478f53f22e7339dc006ab61aac131231552"
1303+
integrity sha512-k2ZCHhJ96YZyPIsykickez+OMHkz06xppVLfJ+DY90i532/Cx2Z+HiRMH8YZQo7a4zVd/TwNBuRCdXlGK4yo8w==
13041304

1305-
"@typescript-eslint/typescript-estree@4.6.0":
1306-
version "4.6.0"
1307-
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.6.0.tgz#85bd98dcc8280511cfc5b2ce7b03a9ffa1732b08"
1308-
integrity sha512-s4Z9qubMrAo/tw0CbN0IN4AtfwuehGXVZM0CHNMdfYMGBDhPdwTEpBrecwhP7dRJu6d9tT9ECYNaWDHvlFSngA==
1305+
"@typescript-eslint/typescript-estree@4.6.1":
1306+
version "4.6.1"
1307+
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.6.1.tgz#6025cce724329413f57e4959b2d676fceeca246f"
1308+
integrity sha512-/J/kxiyjQQKqEr5kuKLNQ1Finpfb8gf/NpbwqFFYEBjxOsZ621r9AqwS9UDRA1Rrr/eneX/YsbPAIhU2rFLjXQ==
13091309
dependencies:
1310-
"@typescript-eslint/types" "4.6.0"
1311-
"@typescript-eslint/visitor-keys" "4.6.0"
1310+
"@typescript-eslint/types" "4.6.1"
1311+
"@typescript-eslint/visitor-keys" "4.6.1"
13121312
debug "^4.1.1"
13131313
globby "^11.0.1"
13141314
is-glob "^4.0.1"
13151315
lodash "^4.17.15"
13161316
semver "^7.3.2"
13171317
tsutils "^3.17.1"
13181318

1319-
"@typescript-eslint/visitor-keys@4.6.0":
1320-
version "4.6.0"
1321-
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.6.0.tgz#fb05d6393891b0a089b243fc8f9fb8039383d5da"
1322-
integrity sha512-38Aa9Ztl0XyFPVzmutHXqDMCu15Xx8yKvUo38Gu3GhsuckCh3StPI5t2WIO9LHEsOH7MLmlGfKUisU8eW1Sjhg==
1319+
"@typescript-eslint/visitor-keys@4.6.1":
1320+
version "4.6.1"
1321+
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.6.1.tgz#6b125883402d8939df7b54528d879e88f7ba3614"
1322+
integrity sha512-owABze4toX7QXwOLT3/D5a8NecZEjEWU1srqxENTfqsY3bwVnl3YYbOh6s1rp2wQKO9RTHFGjKes08FgE7SVMw==
13231323
dependencies:
1324-
"@typescript-eslint/types" "4.6.0"
1324+
"@typescript-eslint/types" "4.6.1"
13251325
eslint-visitor-keys "^2.0.0"
13261326

13271327
"@webassemblyjs/ast@1.9.0":
@@ -6062,9 +6062,9 @@ typedarray@^0.0.6:
60626062
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
60636063

60646064
typescript@^4.1.0-beta:
6065-
version "4.1.0-beta"
6066-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.0-beta.tgz#e4d054035d253b7a37bdc077dd71706508573e69"
6067-
integrity sha512-b/LAttdVl3G6FEmnMkDsK0xvfvaftXpSKrjXn+OVCRqrwz5WD/6QJOiN+dTorqDY+hkaH+r2gP5wI1jBDmdQ7A==
6065+
version "4.1.0-dev.20201102"
6066+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.0-dev.20201102.tgz#e1978890ac063bb3f13d067067905b312c1e0897"
6067+
integrity sha512-kyL2MUGRx69NgowtHpnabYzNA3N8CR+XW51kL9my6MfSXyrojytW5P4YmaayHGQhWLRmzzdDvHfkf2PQBHgbUw==
60686068

60696069
unicode-canonical-property-names-ecmascript@^1.0.4:
60706070
version "1.0.4"

0 commit comments

Comments
 (0)