Skip to content

Commit

Permalink
add base react template
Browse files Browse the repository at this point in the history
  • Loading branch information
MoralesJonathan committed Sep 6, 2019
1 parent 214f419 commit 7582a14
Show file tree
Hide file tree
Showing 17 changed files with 13,318 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: node_js
node_js:
- "stable"
cache:
directories:
- node_modules
deploy:
provider: heroku
api_key:
secure: R/+byiFerJ4Wz9OrycAmzSLjnLuY1b08wyC5uS5oiuNcruPX3VjYtSJsq06hQ3BGAylVPyZ0BRrbSPKHR66TR4wJ2Zct2O/cak54kv1Bqp3WzKL4chL2W1nDguHx51qrtJtvZd6Nfki3sIeHCN3ZttgmEsmAgh+JjnImwQZg1QELpVDzr21benJx9ecdwfQjmvqEK5voKUJxsWNt3F0ZgWySlZDUHtYotW5nSTKBW0qsVxlt7OQl08t8m25ZZPykLJ1uFcTSEI5UBnXab4VJ3JPm+xSrSSVs/HrOrRgmOIc9WpIcIE6wj6wJKcgUzU/K3hQOmJiN3X3/8ufPIVLZecJpcdWenhULf+wJEnw3QUHToZO40GHNJarmL4PBnmnhWgBgBxlasmquXp6Z42+7t2j2yLr+OoBZZ92GBdMvvTH+0SRV7C1s3wL9htJcDwC2QaskkJEJt6fJFBmqI2XxxyWUizpIt4ZtMTATCRoRpZRIsNFEJZl0U4tjuuAJ5VmUI3iZDkGI7Krc8oGPeVPNRucX7OhX2ZwbjvqQcvpAe4TMZeAeTz9YoYfFaaFZlx9HK2RxOioLNtNrtcqxVF+0swQUPjJFAUP7yCmX+S8K9blciHu3nkJq9iLos/xkDmrqlLVOd/km4x38h7aRkSRHbgafUqbpU9eH8QmauN+AuVI=
app: emerge2019
48 changes: 48 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "reacttemplate",
"version": "0.1.0",
"private": true,
"dependencies": {
"normalize.css": "^8.0.1",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-grid-system": "^5.0.2",
"react-router-dom": "^5.0.1",
"react-scripts": "3.1.0",
"styled-components": "^4.3.2"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@storybook/react": "^5.1.10",
"@storybook/addons": "^5.1.10",
"@storybook/addon-a11y": "^5.1.10",
"@storybook/addon-actions": "^5.1.10",
"@storybook/addon-knobs": "^5.1.10",
"@storybook/addon-links": "^5.1.10",
"storybook-addon-styled-component-theme": "^1.2.4",
"babel-loader": "^8.0.6"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"storybook": "start-storybook",
"build-storybook": "build-storybook"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added public/favicon.ico
Binary file not shown.
16 changes: 16 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
15 changes: 15 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "React App Template",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow: /static/
33 changes: 33 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.App {
text-align: center;
}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 40vmin;
pointer-events: none;
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #61dafb;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
19 changes: 19 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import Theme from './ui/theme';
import Index from './views/Index';
import { BrowserRouter as Router, Route } from "react-router-dom";
import { ThemeProvider } from 'styled-components';

function App() {
return (
<ThemeProvider theme={Theme}>
<Router>
<div>
<Route exact path="/" component={Index} />
</div>
</Router>
</ThemeProvider>
);
}

export default App;
9 changes: 9 additions & 0 deletions src/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});
1 change: 1 addition & 0 deletions src/components/empty.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
delete
22 changes: 22 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
* {
margin: 0;
font-family: system-ui, 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 16px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

body {
font-family: system-ui, 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 16rem;
font-weight: 400;
line-height: 1.3;
color: #222;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}


html {
font-size: 1px;
}
9 changes: 9 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import 'normalize.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(<App />, document.getElementById('root'));
serviceWorker.unregister();
7 changes: 7 additions & 0 deletions src/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 135 additions & 0 deletions src/serviceWorker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
// This optional code is used to register a service worker.
// register() is not called by default.

// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.

// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA

const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);

export function register(config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
return;
}

window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;

if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl, config);

// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://bit.ly/CRA-PWA'
);
});
} else {
// Is not localhost. Just register service worker
registerValidSW(swUrl, config);
}
});
}
}

function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
return;
}
installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
console.log(
'New content is available and will be used when all ' +
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
);

// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration);
}
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log('Content is cached for offline use.');

// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration);
}
}
}
};
};
})
.catch(error => {
console.error('Error during service worker registration:', error);
});
}

function checkValidServiceWorker(swUrl, config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
if (
response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
window.location.reload();
});
});
} else {
// Service worker found. Proceed as normal.
registerValidSW(swUrl, config);
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
);
});
}

export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister();
});
}
}
13 changes: 13 additions & 0 deletions src/ui/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default {
primaryColor: "#",
primaryDark: "#",
primaryLight: "#",
secondaryColor: "#",
secondaryLight: "#",
secondaryDark: "#",
lightText: "#",
darkText: "#",
subText: "#",
pageColor: "#",

}
15 changes: 15 additions & 0 deletions src/views/Index/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { Container, Row, Col } from 'react-grid-system';

function Index() {
return (
<Container fluid style={{ height: "100%" }}>
<Row align="center" style={{ height: "100%" }}>
<Col lg={12} md={12} sm={12}>
<p>Hello world</p>
</Col>
</Row>
</Container>
)
}
export default Index;
Loading

0 comments on commit 7582a14

Please sign in to comment.