Skip to content

Commit

Permalink
Merge branch 'main' of github.com:nanlabs/react-webpack-boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
ulises-jeremias committed Jun 10, 2022
2 parents 8a13cde + f162667 commit 96ccf64
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 18 deletions.
27 changes: 12 additions & 15 deletions config/webpack.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,26 @@ const config = {
new WebpackManifestPlugin({
publicPath: `${URL_BASE}/`,
seed: {
name: "app",
short_name: "app",
start_url: "index.html",
display: "standalone",
name: 'app',
short_name: 'app',
start_url: 'index.html',
display: 'standalone',
icons: [
{
src: "favicon.ico",
sizes: "512x512",
type: "image/x-icon"
}
src: 'favicon.ico',
sizes: '512x512',
type: 'image/x-icon',
},
],
background_color: "#4e0041",
theme_color: "#4e0041"
background_color: '#4e0041',
theme_color: '#4e0041',
},
generate: (seed, files, entrypoints) => {
const manifestFiles = files.reduce((manifest, file) => {
manifest[file.name] = file.path;
return manifest;
}, seed);
const entrypointFiles = entrypoints.main.filter(
fileName => !fileName.endsWith('.map')
);
const entrypointFiles = entrypoints.main.filter((fileName) => !fileName.endsWith('.map'));

return {
files: manifestFiles,
Expand All @@ -85,9 +83,8 @@ const config = {
from: commonPaths.favicon,
to: commonPaths.outputPath,
},
]
],
}),
new webpack.HotModuleReplacementPlugin(),
],
};

Expand Down
2 changes: 1 addition & 1 deletion src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ i18n
},

// have a common namespace used around the full app
ns: ['translations'],
ns: ['translations', 'config'],
defaultNS: 'translations',

debug: process.env.NODE_ENV === 'development',
Expand Down
13 changes: 13 additions & 0 deletions src/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import Cracked from 'components/Animation/Cracked';

import './Landing.css';
import { useTranslation } from 'react-i18next';

const Home = () => {
const { t } = useTranslation();

return <Cracked>{t('brand')}</Cracked>;
};

export default Home;
7 changes: 6 additions & 1 deletion src/pages/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import React from 'react';
import Cracked from 'components/Animation/Cracked';

import './Landing.css';
import { useTranslation } from 'react-i18next';

const Landing = () => <Cracked>app</Cracked>;
const Landing = () => {
const { t } = useTranslation('config');

return <Cracked>{t('app.title')}</Cracked>;
};

export default Landing;
2 changes: 2 additions & 0 deletions src/routes/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import React from 'react';
import { Route, Routes } from 'react-router-dom';

import Landing from 'pages/Landing';
import Home from 'pages/Home';

const AppRoutes = () => (
<Routes>
<Route path="/" element={<Landing />} />
<Route path="/nan-labs" element={<Home />} />
</Routes>
);

Expand Down
5 changes: 5 additions & 0 deletions static/locales/en/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"app": {
"title": "React Webpack Boilerplate"
}
}
4 changes: 3 additions & 1 deletion static/locales/en/translations.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"brand": "NaNLabs"
}

0 comments on commit 96ccf64

Please sign in to comment.