Skip to content

Commit 2119a6f

Browse files
committed
init
0 parents  commit 2119a6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+26973
-0
lines changed

.gitignore

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (http://nodejs.org/api/addons.html)
33+
build/Release
34+
35+
# Dependency directories
36+
**/node_modules/
37+
node_modules/
38+
jspm_packages/
39+
40+
# Typescript v1 declaration files
41+
typings/
42+
43+
# Optional npm cache directory
44+
.npm
45+
46+
# Optional eslint cache
47+
.eslintcache
48+
49+
# Optional REPL history
50+
.node_repl_history
51+
52+
# Output of 'npm pack'
53+
*.tgz
54+
55+
# dotenv environment variable files
56+
.env*
57+
58+
# gatsby files
59+
/**/.cache
60+
/**/public
61+
62+
# Mac files
63+
.DS_Store
64+
65+
# Yarn
66+
yarn-error.log
67+
.pnp/
68+
.pnp.js
69+
# Yarn Integrity file
70+
.yarn-integrity
71+
72+
.idea
73+
dist/

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": true,
3+
"bracketSpacing": false,
4+
"jsxBracketSameLine": true,
5+
"printWidth": 100,
6+
"trailingComma": "none"
7+
}

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 Dmitriy Nevzorov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

example/babel.config.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
presets: [['react-app', {flow: false, typescript: true}]],
3+
plugins: [
4+
[
5+
'i18next-extract',
6+
{
7+
keySeparator: null,
8+
nsSeparator: null,
9+
keyAsDefaultValue: ['en'],
10+
useI18nextDefaultValue: ['en'],
11+
discardOldKeys: true,
12+
outputPath: 'locales/{{locale}}/{{ns}}.json',
13+
customTransComponents: [['gatsby-plugin-react-i18next', 'Trans']]
14+
}
15+
]
16+
]
17+
};

example/gatsby-config.js

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
const {languages, defaultLanguage} = require('./languages');
2+
3+
module.exports = {
4+
siteMetadata: {
5+
title: `Gatsby Default Starter`,
6+
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
7+
author: `@gatsbyjs`,
8+
pathPrefix: `/blog`
9+
},
10+
plugins: [
11+
`gatsby-plugin-react-helmet`,
12+
{
13+
resolve: `gatsby-source-filesystem`,
14+
options: {
15+
name: `images`,
16+
path: `${__dirname}/src/images`
17+
}
18+
},
19+
`gatsby-transformer-sharp`,
20+
`gatsby-plugin-sharp`,
21+
{
22+
resolve: `gatsby-plugin-manifest`,
23+
options: {
24+
name: `gatsby-starter-default`,
25+
short_name: `starter`,
26+
start_url: `/`,
27+
background_color: `#663399`,
28+
theme_color: `#663399`,
29+
display: `minimal-ui`,
30+
icon: `src/images/gatsby-icon.png` // This path is relative to the root of the site.
31+
}
32+
},
33+
{
34+
// including a plugin from outside the plugins folder needs the path to it
35+
resolve: 'gatsby-plugin-react-i18next',
36+
options: {
37+
languages,
38+
defaultLanguage,
39+
path: `${__dirname}/locales`,
40+
i18nextOptions: {
41+
debug: true,
42+
lowerCaseLng: true,
43+
saveMissing: false,
44+
interpolation: {
45+
escapeValue: false // not needed for react as it escapes by default
46+
},
47+
keySeparator: false,
48+
nsSeparator: false
49+
}
50+
}
51+
}
52+
// this (optional) plugin enables Progressive Web App + Offline functionality
53+
// To learn more, visit: https://gatsby.dev/offline
54+
// `gatsby-plugin-offline`,
55+
]
56+
};

example/languages.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
languages: ['en', 'es', 'de', 'it', 'fr'],
3+
defaultLanguage: 'en'
4+
};

example/locales/de/translation.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"Home": "Zuhause",
3+
"NOT FOUND": "NICHT GEFUNDEN",
4+
"Hi people": "Hallo Leute",
5+
"Now go build something great.": "Jetzt baue etwas Großartiges.",
6+
"Go back to the homepage": "Zurück zur Homepage",
7+
"Welcome to your new Gatsby site.": "Willkommen auf Ihrer neuen Gatsby Website.",
8+
"404: Not found": "404: Nicht gefunden",
9+
"Page two": "Seite zwei",
10+
"Go to page 2": "Gehe zu Seite 2",
11+
"Welcome to page 2 ()": "Willkommen auf Seite 2 ()",
12+
"You just hit a route that doesn't exist... the sadness.": "Du hast gerade eine Route getroffen, die nicht existiert... die Traurigkeit.",
13+
"Welcome to page 2": "Willkommen auf Seite 2"
14+
}

example/locales/en/translation.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"404: Not found": "404: Not found",
3+
"Go back to the homepage": "Go back to the homepage",
4+
"Go to page 2": "Go to page 2",
5+
"Hi people": "Hi people",
6+
"Home": "Home",
7+
"NOT FOUND": "NOT FOUND",
8+
"Now go build something great.": "Now go build something great.",
9+
"Page two": "Page two",
10+
"Welcome to page 2": "Welcome to page 2",
11+
"Welcome to your new Gatsby site.": "Welcome to your new Gatsby site.",
12+
"You just hit a route that doesn't exist... the sadness.": "You just hit a route that doesn't exist... the sadness."
13+
}

example/locales/es/translation.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"language": "Español",
3+
"Home": "Casa",
4+
"NOT FOUND": "NO ENCONTRADO",
5+
"Go back to the homepage": "Volver a la página de inicio",
6+
"Page two": "Página dos",
7+
"Hi people": "Hola gente",
8+
"Now go build something great.": "Ahora ve a construir algo grande.",
9+
"404: Not found": "404: No encontrado",
10+
"Go to page 2": "Ir a la página 2",
11+
"Welcome to your new Gatsby site.": "Bienvenido a su nuevo sitio de Gatsby.",
12+
"Welcome to page 2 ()": "Bienvenido a la página 2 ()",
13+
"You just hit a route that doesn't exist... the sadness.": "Acabas de llegar a una ruta que no existe... la tristeza.",
14+
"Welcome to page 2": "Bienvenido a la página 2"
15+
}

example/locales/fr/translation.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"Go to page 2": "Aller à la page 2",
3+
"Page two": "Page deux",
4+
"Go back to the homepage": "Retourner à la page d'accueil",
5+
"Home": "Accueil",
6+
"Welcome to page 2 ()": "Bienvenue à la page 2 ()",
7+
"Welcome to your new Gatsby site.": "Bienvenue sur votre nouveau site Gatsby.",
8+
"Now go build something great.": "Maintenant va construire quelque chose de génial.",
9+
"404: Not found": "404 : Non trouvé",
10+
"Hi people": "Salut les gens",
11+
"NOT FOUND": "INTROUVABLE",
12+
"You just hit a route that doesn't exist... the sadness.": "Tu viens d'emprunter une route qui n'existe pas... la tristesse.",
13+
"Welcome to page 2": "Bienvenue à la page 2"
14+
}

example/locales/it/translation.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"Home": "Casa",
3+
"Go to page 2": "Vai alla pagina 2",
4+
"NOT FOUND": "NON TROVATO",
5+
"Go back to the homepage": "Torna alla homepage",
6+
"Welcome to page 2 ()": "Benvenuti a pagina 2 ()",
7+
"Hi people": "Ciao persone",
8+
"404: Not found": "404: Non trovato",
9+
"Page two": "Pagina due",
10+
"Now go build something great.": "Ora vai a costruire qualcosa di grande.",
11+
"Welcome to your new Gatsby site.": "Benvenuto nel tuo nuovo sito di Gatsby.",
12+
"You just hit a route that doesn't exist... the sadness.": "Hai appena fatto una strada che non esiste... la tristezza.",
13+
"Welcome to page 2": "Benvenuto a pagina 2"
14+
}

example/package.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "gatsby-starter-default",
3+
"private": true,
4+
"description": "A simple starter to get up and developing quickly with Gatsby",
5+
"version": "0.1.0",
6+
"author": "Kyle Mathews <[email protected]>",
7+
"dependencies": {
8+
"gatsby": "^2.21.37",
9+
"gatsby-image": "^2.4.4",
10+
"gatsby-plugin-manifest": "^2.4.5",
11+
"gatsby-plugin-offline": "^3.2.3",
12+
"gatsby-plugin-react-helmet": "^3.3.1",
13+
"gatsby-plugin-sharp": "^2.6.4",
14+
"gatsby-source-filesystem": "^2.3.4",
15+
"gatsby-transformer-sharp": "^2.5.2",
16+
"prop-types": "^15.7.2",
17+
"react": "^16.12.0",
18+
"react-dom": "^16.12.0",
19+
"react-helmet": "^6.0.0"
20+
},
21+
"devDependencies": {
22+
"@babel/cli": "^7.8.4",
23+
"aws-sdk": "^2.683.0",
24+
"babel-plugin-i18next-extract": "^0.7.2",
25+
"babel-preset-react-app": "^9.1.2",
26+
"mkdirp": "^1.0.4",
27+
"prettier": "2.0.5"
28+
},
29+
"keywords": [
30+
"gatsby"
31+
],
32+
"license": "MIT",
33+
"scripts": {
34+
"build": "gatsby build",
35+
"develop": "gatsby develop",
36+
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
37+
"start": "npm run develop",
38+
"serve": "gatsby serve",
39+
"clean": "gatsby clean",
40+
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1",
41+
"extract": "NODE_ENV=development yarn run babel -f babel.config.js -o tmp/chunk.js 'src/**/*.{js,jsx,ts,tsx}' && rm -rf tmp",
42+
"translate": "yarn run extract && node translate.js"
43+
},
44+
"repository": {
45+
"type": "git",
46+
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
47+
},
48+
"bugs": {
49+
"url": "https://github.com/gatsbyjs/gatsby/issues"
50+
}
51+
}

example/src/components/header.css

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.main-header {
2+
background: rebeccapurple;
3+
margin-bottom: 1.45rem;
4+
display: flex;
5+
justify-content: space-between;
6+
align-items: center;
7+
padding: 1.45rem 1.0875rem;
8+
}
9+
10+
.main-header a {
11+
color: white;
12+
text-decoration: none;
13+
}
14+
15+
.languages {
16+
list-style: none;
17+
display: flex;
18+
margin: 0;
19+
padding: 0;
20+
}
21+
22+
.languages > li {
23+
padding: 0 0.45rem;
24+
margin: 0;
25+
}

example/src/components/header.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import {Link, useI18next} from 'gatsby-plugin-react-i18next';
2+
import PropTypes from 'prop-types';
3+
import './header.css';
4+
import React from 'react';
5+
6+
const Header = ({siteTitle}) => {
7+
const {languages, changeLanguage} = useI18next();
8+
return (
9+
<header className="main-header">
10+
<h1 style={{margin: 0}}>
11+
<Link
12+
to="/"
13+
style={{
14+
color: `white`,
15+
textDecoration: `none`
16+
}}>
17+
{siteTitle}
18+
</Link>
19+
</h1>
20+
<ul className="languages">
21+
{languages.map((lng) => (
22+
<li key={lng}>
23+
<a
24+
href="#"
25+
onClick={(e) => {
26+
e.preventDefault();
27+
changeLanguage(lng);
28+
}}>
29+
{lng}
30+
</a>
31+
</li>
32+
))}
33+
</ul>
34+
</header>
35+
);
36+
};
37+
38+
Header.propTypes = {
39+
siteTitle: PropTypes.string
40+
};
41+
42+
Header.defaultProps = {
43+
siteTitle: ``
44+
};
45+
46+
export default Header;

0 commit comments

Comments
 (0)