Skip to content

Commit 8fba666

Browse files
committed
fix(examples): remove last of scss from material-ui complete example
1 parent 2efe452 commit 8fba666

21 files changed

+114
-760
lines changed

examples/complete/material/.eslintrc.js

+2-25
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
2+
'extends': ['react-app', 'prettier'],
23
root: true,
34
parser: 'babel-eslint',
4-
extends: ['react-app', 'prettier'],
55
plugins: ['import', 'babel', 'react', 'prettier'],
66
settings: {
77
react: {
@@ -35,28 +35,5 @@ module.exports = {
3535
useTabs: false
3636
}
3737
]
38-
},
39-
overrides: [
40-
{
41-
files: ['*.test.js', '*.spec.js'],
42-
env: {
43-
jest: true
44-
}
45-
},
46-
{
47-
files: ['config/*', 'scripts/*'],
48-
rules: {
49-
'no-console': 0,
50-
'func-names': 0,
51-
'prefer-destructuring': 0,
52-
'no-use-before-define': 0,
53-
'import/order': 0,
54-
'consistent-return': 0,
55-
'no-param-reassign': 0,
56-
'import/no-extraneous-dependencies': 0,
57-
'global-require': 0,
58-
'import/no-dynamic-require': 0
59-
}
60-
}
61-
]
38+
}
6239
}

examples/complete/material/.firebaserc

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"master": {
1010
"env": "staging",
1111
"firebase": {
12-
"apiKey": "AIzaSyCTUERDM-Pchn_UDTsfhVPiwM4TtNIxots",
12+
"apiKey": "${STAGE_FIREBASE_API_KEY}",
1313
"authDomain": "redux-firebasev3.firebaseapp.com",
1414
"databaseURL": "https://redux-firebasev3.firebaseio.com",
1515
"projectId": "redux-firebasev3",
@@ -19,7 +19,7 @@
1919
"prod": {
2020
"env": "production",
2121
"firebase": {
22-
"apiKey": "AIzaSyCTUERDM-Pchn_UDTsfhVPiwM4TtNIxots",
22+
"apiKey": "${PROD_FIREBASE_API_KEY}",
2323
"authDomain": "redux-firebasev3.firebaseapp.com",
2424
"databaseURL": "https://redux-firebasev3.firebaseio.com",
2525
"projectId": "redux-firebasev3",

examples/complete/material/.gitlab-ci.yml

-4
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ Build Production:
102102
when: always
103103
paths:
104104
- dist
105-
dependencies:
106-
- Build
107105
script:
108106
- npm run clean # remove existing dist folder
109107
- npm run build:config # create env specific src/config.js
@@ -132,8 +130,6 @@ Deploy Production:
132130
when: on_failure
133131
paths:
134132
- firebase-debug.log
135-
dependencies:
136-
- Build # Load artifacts from build stage
137133
except:
138134
variables:
139135
- $CI_COMMIT_MESSAGE =~ /skip-deploy/
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"generator-react-firebase": {
3+
"promptValues": {
4+
"githubUser": "prescottprue",
5+
"firebaseName": "redux-firebasev3",
6+
"firebaseKey": "AIzaSyCTUERDM-Pchn_UDTsfhVPiwM4TtNIxots",
7+
"includeRedux": true,
8+
"includeFirestore": false,
9+
"otherFeatures": [
10+
"Config for Continuous Integration"
11+
],
12+
"ciProvider": "gitlab",
13+
"deployTo": "firebase"
14+
}
15+
}
16+
}

examples/complete/material/README.md

+39-65
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
# react-redux-firebase Complete Material Example
1+
# material
22

33
[![License][license-image]][license-url]
44
[![Code Style][code-style-image]][code-style-url]
55

6-
## What is Shown
6+
## Table of Contents
77

8-
* Route protection using `redux-auth-wrapper`
9-
* Data input/validation using `redux-form`
10-
* Async & Sync route loading
11-
* Real CI and Deployment settings (including `prod` and `stage` environments)
12-
* Using different instances of Firebase based on environment
8+
1. [Features](#features)
9+
1. [Requirements](#requirements)
10+
1. [Getting Started](#getting-started)
11+
1. [Application Structure](#application-structure)
12+
1. [Development](#development)
13+
1. [Routing](#routing)
14+
1. [Configuration](#configuration)
15+
1. [Production](#production)
16+
1. [Deployment](#deployment)
1317

1418
## Requirements
1519

@@ -40,9 +44,9 @@ While developing, you will probably rely mostly on `npm start`; however, there a
4044

4145
|`npm run <script>` |Description|
4246
|-------------------|-----------|
43-
|`start` |Serves your app at `localhost:3000` and displays [Webpack Dashboard](https://github.com/FormidableLabs/webpack-dashboard)|
44-
|`start:simple` |Serves your app at `localhost:3000` without [Webpack Dashboard](https://github.com/FormidableLabs/webpack-dashboard)|
45-
|`build` |Builds the application to ./dist|
47+
|`start` |Serves your app at `localhost:3000` with automatic refreshing and hot module replacement|
48+
|`start:dist` |Builds the application to `./dist` then serves at `localhost:3000` using `firebase serve`|
49+
|`build` |Builds the application to `./dist`|
4650
|`lint` |[Lints](http://stackoverflow.com/questions/8503559/what-is-linting) the project for potential errors|
4751
|`lint:fix` |Lints the project and [fixes all correctable errors](http://eslint.org/docs/user-guide/command-line-interface.html#fix)|
4852

@@ -52,7 +56,6 @@ While developing, you will probably rely mostly on `npm start`; however, there a
5256

5357
There are multiple configuration files:
5458

55-
* Project Path Configuration - `project.config.js`
5659
* Firebase Project Configuration (including settings for how `src/config.js` is built on CI) - `.firebaserc`
5760
* Project Configuration used within source (can change based on environment variables on CI) - `src/config.js`
5861
* Cloud Functions Local Configuration - `functions/.runtimeconfig.json`
@@ -61,22 +64,20 @@ More details in the [Application Structure Section](#application-structure)
6164

6265
## Application Structure
6366

64-
The application structure presented in this boilerplate is **fractal**, where functionality is grouped primarily by feature rather than file type. Please note, however, that this structure is only meant to serve as a guide, it is by no means prescriptive. That said, it aims to represent generally accepted guidelines and patterns for building scalable applications. If you wish to read more about this pattern, please check out this [awesome writeup](https://github.com/davezuko/react-redux-starter-kit/wiki/Fractal-Project-Structure) by [Justin Greenberg](https://github.com/justingreenberg).
67+
The application structure presented in this boilerplate is **fractal**, where functionality is grouped primarily by feature rather than file type. Please note, however, that this structure is only meant to serve as a guide, it is by no means prescriptive. That said, it aims to represent generally accepted guidelines and patterns for building scalable applications.
6568

6669
```
67-
├── build # All build-related configuration
70+
├── public # All build-related configuration
71+
│ ├── index.html # Main HTML page container for app
6872
│ ├── scripts # Scripts used within the building process
69-
│ ├── karma.config.js # Test configuration for Karma
70-
│ └── webpack.config.js # Environment-specific configuration files for webpack
71-
├── server # Express application that provides webpack middleware
72-
│ └── main.js # Server application entry point
73+
│ │ └── compile.js # Custom Compiler that calls Webpack compiler
74+
│ │ └── start.js # Starts the custom compiler
7375
├── src # Application source code
7476
│ ├── config.js # Environment specific config file with settings from Firebase (created by CI)
75-
│ ├── constants.js # Project constants such as firebase paths and form names
76-
│ ├── index.html # Main HTML page container for app
77-
│ ├── main.js # Application bootstrap and rendering
78-
│ ├── normalize.js # Browser normalization and polyfills
7977
│ ├── components # Global Reusable Presentational Components
78+
│ ├── constants # Project constants such as firebase paths and form names
79+
│ │ ├── formNames.js # Names of redux forms
80+
│ │ └── paths.js # Paths for application routes
8081
│ ├── containers # Global Reusable Container Components (connected to redux state)
8182
│ ├── layouts # Components that dictate major page structure
8283
│ │ └── CoreLayout # Global application layout in which to render routes
@@ -93,21 +94,29 @@ The application structure presented in this boilerplate is **fractal**, where fu
9394
│ │ ├── createStore.js # Create and instrument redux store
9495
│ │ └── reducers.js # Reducer registry and injection
9596
│ ├── styles # Application-wide styles (generally settings)
96-
│ └── utils # General Utilities (used throughout application)
97-
│ │ ├── components.js # Utilities for building/implementing react components (often used in enhancers)
98-
│ │ ├── form.js # For forms (often used in enhancers that use redux-form)
99-
│ │ └── router.js # Utilities for routing such as those that redirect back to home if not logged in
100-
├── project.config.js # Project configuration settings
97+
│ └── utils # General Utilities (used throughout application)
98+
│ │ ├── components.js # Utilities for building/implementing react components (often used in enhancers)
99+
│ │ ├── form.js # For forms (often used in enhancers that use redux-form)
100+
│ │ └── router.js # Utilities for routing such as those that redirect back to home if not logged in
101+
├── tests # Unit tests
102+
├── .env.local # Environment settings for when running locally
103+
├── .eslintignore # ESLint ignore file
104+
├── .eslintrc.js # ESLint configuration
101105
├── .firebaserc # Firebase Project configuration settings (including ci settings)
102-
└── tests # Unit tests
106+
├── database.rules.json # Rules for Firebase Real Time Database
107+
├── firebase.json # Firebase Service settings (Hosting, Functions, etc)
108+
├── firestore.indexes.json # Indexs for Cloud Firestore
109+
├── firestore.rules # Rules for Cloud Firestore
110+
└── storage.rules # Rules for Cloud Storage For Firebase
103111
```
104112

105-
### Routing
113+
## Routing
114+
106115
We use `react-router-dom` [route matching](https://reacttraining.com/react-router/web/guides/basic-components/route-matching) (`<route>/index.js`) to define units of logic within our application. The application routes are defined within `src/routes/index.js`, which loads route settings which live in each route's `index.js`. The component with the suffix `Page` is the top level component of each route (i.e. `HomePage` is the top level component for `Home` route).
107116

108117
There are two types of routes definitions:
109118

110-
#### Sync Routes
119+
### Sync Routes
111120

112121
The most simple way to define a route is a simple object with `path` and `component`:
113122

@@ -123,7 +132,7 @@ export default {
123132
}
124133
```
125134

126-
#### Async Routes
135+
### Async Routes
127136

128137
Routes can also be seperated into their own bundles which are only loaded when visiting that route, which helps decrease the size of your main application bundle. Routes that are loaded asynchronously are defined using `react-loadable`:
129138

@@ -147,41 +156,6 @@ With this setting, the name of the file (called a "chunk") is defined as part of
147156

148157
More about how routing works is available in [the react-router-dom docs](https://reacttraining.com/react-router/web/guides/quick-start).
149158

150-
## Production
151-
152-
Build code before deployment by running `npm run build`. There are multiple options below for types of deployment, if you are unsure, checkout the Firebase section.
153-
154-
### Deployment
155-
156-
157-
1. Install Firebase Command Line Tool: `npm i -g firebase-tools`
158-
159-
#### CI Deploy (recommended)
160-
161-
**Note**: Config for this is located within
162-
`firebase-ci` has been added to simplify the CI deployment process. All that is required is providing authentication with Firebase:
163-
164-
1. Login: `firebase login:ci` to generate an authentication token (will be used to give Travis-CI rights to deploy on your behalf)
165-
1. Set `FIREBASE_TOKEN` environment variable within Travis-CI environment
166-
1. Run a build on CI
167-
168-
If you would like to deploy to different Firebase instances for different branches (i.e. `prod`), change `ci` settings within `.firebaserc`.
169-
170-
For more options on CI settings checkout the [firebase-ci docs](https://github.com/prescottprue/firebase-ci)
171-
172-
#### Manual deploy
173-
174-
1. Run `firebase:login`
175-
1. Initialize project with `firebase init` then answer:
176-
* What file should be used for Database Rules? -> `database.rules.json`
177-
* What do you want to use as your public directory? -> `build`
178-
* Configure as a single-page app (rewrite all urls to /index.html)? -> `Yes`
179-
* What Firebase project do you want to associate as default? -> **your Firebase project name**
180-
1. Build Project: `npm run build`
181-
1. Confirm Firebase config by running locally: `firebase serve`
182-
1. Deploy to Firebase (everything including Hosting and Functions): `firebase deploy`
183-
184-
**NOTE:** You can use `firebase serve` to test how your application will work when deployed to Firebase, but make sure you run `npm run build` first.
185159

186160
## FAQ
187161

examples/complete/material/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"clean": "rimraf dist",
88
"start": "react-scripts start",
99
"build": "react-scripts build",
10-
"eject": "react-scripts eject","createConfig": "firebase-ci createConfig",
10+
"eject": "react-scripts eject",
11+
"build:config": "firebase-ci createConfig",
1112
"deploy": "firebase-ci deploy -s",
1213
"lint": "eslint .",
1314
"lint:fix": "npm run lint -- --fix",
@@ -32,12 +33,12 @@
3233
"prop-types": "^15.6.1",
3334
"react": "^16.6.3",
3435
"react-dom": "^16.6.3",
35-
"react-scripts": "2.1.1",
3636
"react-google-button": "^0.5.3",
3737
"react-loadable": "^5.5.0",
3838
"react-redux": "^5.0.7",
3939
"react-redux-firebase": "^2.1.9",
4040
"react-router-dom": "^4.3.1",
41+
"react-scripts": "2.1.1",
4142
"recompose": "^0.30.0",
4243
"redux": "^4.0.0",
4344
"redux-auth-wrapper": "^2.0.3",
@@ -59,7 +60,7 @@
5960
"prettier": "^1.14.3"
6061
},
6162
"eslintConfig": {
62-
"extends": "./eslintrc.json"
63+
"extends": "./eslintrc.js"
6364
},
6465
"browserslist": [
6566
">0.2%",

examples/complete/material/src/containers/Navbar/AccountMenu.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const styles = {
1212
}
1313
}
1414

15-
export const AccountMenu = ({
15+
const AccountMenu = ({
1616
avatarUrl,
1717
displayName,
1818
goToAccount,
@@ -44,14 +44,14 @@ export const AccountMenu = ({
4444
)
4545

4646
AccountMenu.propTypes = {
47-
displayName: PropTypes.string,
48-
avatarUrl: PropTypes.string,
47+
classes: PropTypes.object.isRequired, // from enhancer (withStyles)
4948
goToAccount: PropTypes.func.isRequired,
5049
onLogoutClick: PropTypes.func.isRequired,
51-
anchorEl: PropTypes.object,
5250
closeAccountMenu: PropTypes.func.isRequired,
5351
handleMenu: PropTypes.func.isRequired,
54-
classes: PropTypes.object.isRequired // from withStyles
52+
displayName: PropTypes.string,
53+
avatarUrl: PropTypes.string,
54+
anchorEl: PropTypes.object
5555
}
5656

5757
export default withStyles(styles)(AccountMenu)

examples/complete/material/src/index.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
}
2121
/* [type=button]{
2222
-webkit-appearance: none !important;
23-
} */
23+
} */

examples/complete/material/src/routes/Account/components/ProviderDataForm/ProviderDataForm.js

+11-14
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,18 @@ import ListItemIcon from '@material-ui/core/ListItemIcon'
66
import ListItemText from '@material-ui/core/ListItemText'
77
import ListSubheader from '@material-ui/core/ListSubheader'
88
import AccountCircle from '@material-ui/icons/AccountCircle'
9-
import classes from './ProviderDataForm.scss'
109

11-
export const ProviderData = ({ providerData }) => (
12-
<div className={classes.container}>
13-
<List subheader={<ListSubheader>Accounts</ListSubheader>}>
14-
{providerData.map((providerAccount, i) => (
15-
<ListItem key={i}>
16-
<ListItemIcon>
17-
<AccountCircle />
18-
</ListItemIcon>
19-
<ListItemText primary={providerAccount.providerId} />
20-
</ListItem>
21-
))}
22-
</List>
23-
</div>
10+
const ProviderData = ({ providerData }) => (
11+
<List subheader={<ListSubheader>Accounts</ListSubheader>}>
12+
{providerData.map((providerAccount, i) => (
13+
<ListItem key={i}>
14+
<ListItemIcon>
15+
<AccountCircle />
16+
</ListItemIcon>
17+
<ListItemText primary={providerAccount.providerId} />
18+
</ListItem>
19+
))}
20+
</List>
2421
)
2522

2623
ProviderData.propTypes = {

examples/complete/material/src/routes/Account/components/ProviderDataForm/ProviderDataForm.scss

-5
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
import { compose } from 'recompose'
12
import { reduxForm } from 'redux-form'
23
import { NEW_PROJECT_FORM_NAME } from 'constants/formNames'
4+
import { withStyles } from '@material-ui/core/styles'
5+
import styles from './NewProjectDialog.styles'
36

4-
export default reduxForm({
5-
form: NEW_PROJECT_FORM_NAME,
6-
// Clear the form for future use (creating another project)
7-
onSubmitSuccess: (result, dispatch, props) => props.reset()
8-
})
7+
export default compose(
8+
reduxForm({
9+
form: NEW_PROJECT_FORM_NAME,
10+
// Clear the form for future use (creating another project)
11+
onSubmitSuccess: (result, dispatch, props) => props.reset()
12+
}),
13+
withStyles(styles)
14+
)

0 commit comments

Comments
 (0)