Skip to content

Commit 01e551e

Browse files
author
Nicolas Garnier
committed
Readme updates
1 parent 2d7d430 commit 01e551e

File tree

3 files changed

+41
-37
lines changed

3 files changed

+41
-37
lines changed

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# FirebaseUI React Components
22

3-
FirebaseUI React Components provides a React Wrapper on top of the [Firebase UI Web library](https://github.com/firebase/firebaseui-web/) and notably Firebase UI Auth.
3+
FirebaseUI React Components provides React Wrappers on top of the [Firebase UI Web library](https://github.com/firebase/firebaseui-web/) and notably Firebase UI Auth.
44

55
FirebaseUI Auth provides a drop-in auth solution that handles the UI flows for signing in users with email addresses and passwords, and Identity Provider Sign In using Google, Facebook and others. It is built on top of Firebase Auth.
66

@@ -50,7 +50,7 @@ firebase.initializeApp(config);
5050
const uiConfig = {
5151
// Popup signin flow rather than redirect flow.
5252
signInFlow: 'popup',
53-
// Redirect to /signedIn after sign in is successful. Alternatively you can use provide a callbacks.signInSuccess function.
53+
// Redirect to /signedIn after sign in is successful. Alternatively you can provide a callbacks.signInSuccess function.
5454
signInSuccessUrl: '/signedIn',
5555
// We will display Google and Facebook as auth providers.
5656
signInOptions: [
@@ -62,9 +62,11 @@ const uiConfig = {
6262
class SignInScreen extends React.Component {
6363
render() {
6464
return (
65-
<h1>My App</h1>
66-
<p>Please sign-in:</p>
67-
<FirebaseAuth uiConfig={uiConfig} firebaseAuth={firebase.auth()}/>
65+
<div>
66+
<h1>My App</h1>
67+
<p>Please sign-in:</p>
68+
<FirebaseAuth uiConfig={uiConfig} firebaseAuth={firebase.auth()}/>
69+
</div>
6870
);
6971
}
7072
}
@@ -94,13 +96,12 @@ class SignInScreen extends React.Component {
9496
uiConfig = {
9597
// Popup signin flow rather than redirect flow.
9698
signInFlow: 'popup',
97-
// Redirect to /signedIn after sign in is successful. Alternatively you can use provide a callbacks.signInSuccess function.
98-
signInSuccessUrl: '/signedIn',
9999
// We will display Google and Facebook as auth providers.
100100
signInOptions: [
101101
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
102102
firebase.auth.FacebookAuthProvider.PROVIDER_ID
103103
],
104+
// Sets the `signedIn` state property to `true` once signed in.
104105
callbacks: {
105106
signInSuccess: () => {
106107
this.setState({signedIn: true});
@@ -116,14 +117,18 @@ class SignInScreen extends React.Component {
116117
render() {
117118
if (!this.state.signedIn) {
118119
return (
119-
<h1>My App</h1>
120-
<p>Please sign-in:</p>
121-
<FirebaseAuth uiConfig={this.uiConfig} firebaseAuth={firebase.auth()}/>
120+
<div>
121+
<h1>My App</h1>
122+
<p>Please sign-in:</p>
123+
<FirebaseAuth uiConfig={this.uiConfig} firebaseAuth={firebase.auth()}/>
124+
</div>
122125
);
123126
}
124127
return (
125-
<h1>My App</h1>
126-
<p>Welcome! You are now signed-in!</p>
128+
<div>
129+
<h1>My App</h1>
130+
<p>Welcome! You are now signed-in!</p>
131+
</div>
127132
);
128133
}
129134
}
@@ -134,7 +139,7 @@ class SignInScreen extends React.Component {
134139
The `FirebaseAuth` component needs a global CSS to get proper styling. The CSS is already import within `FirebaseAuth`.
135140
If you are using webpack you'll need to add [CSS loaders](https://github.com/webpack-contrib/css-loader):
136141

137-
```json
142+
```js
138143
{
139144
module: {
140145
rules: [
@@ -151,7 +156,7 @@ If you are using webpack you'll need to add [CSS loaders](https://github.com/web
151156

152157
If you are using [`ExtractTextPlugin`](https://github.com/webpack-contrib/extract-text-webpack-plugin) to extract a CSS file from the required CSS files you would typically use:
153158

154-
```json
159+
```js
155160
{
156161
plugins: [new ExtractTextPlugin('./bundle.css')],
157162
module: {
@@ -173,7 +178,7 @@ If you are using [`ExtractTextPlugin`](https://github.com/webpack-contrib/extrac
173178

174179
If you are using CSS modules in your app you need to handle the CSS files in `/node_modules/` in a separate loader so that they are imported as global CSS files and not modules. Your setup could look like:
175180

176-
```json
181+
```js
177182
{
178183
plugins: [new ExtractTextPlugin('./bundle.css')],
179184
module: {
@@ -227,12 +232,11 @@ If you would like to see an example of styling, have a look at the [example app]
227232

228233
## Using multiple instances
229234

230-
In the rare case where you would need to load multiple instances of `FirebaseAuth` at the same time you need to pass them a different ID using the `elementId` attribute. For instance:
235+
In the case where you would need to load multiple instances of `FirebaseAuth` at the same time you need to set them up with a different ID using the `elementId` attribute. For instance:
231236

232237
```js
233238
<FirebaseAuth elementId="auth_1" uiConfig={this.uiConfig} firebaseAuth={firebase.auth()}/>
234-
<FirebaseAuth elementId="auth_2" uiConfig={this.uiConfig} firebaseAuth={firebase.auth()}/>
235-
239+
<FirebaseAuth elementId="auth_2" uiConfig={this.otherUiConfig} firebaseAuth={firebase.auth()}/>
236240
```
237241

238242

dist/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Compiled files output.

example/README.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,24 @@ This is a sample app showing a usage of the react-firebaseui package in a react
55

66
## Initial setup, building and serving.
77

8-
Run `npm install` to install all run-time and build dependencies.
9-
10-
```bash
11-
npm install
12-
```
13-
14-
Run the build script to transpile and pack the app sources.
15-
16-
```bash
17-
npm run build
18-
```
19-
20-
Serve the app
21-
22-
```bash
23-
npm run serve
24-
```
25-
26-
Try out the app by opening [http://localhost:5000](http://localhost:5000) in your browser.
8+
1. Create a Firebase project using the [Firebase console](https://console.firebase.google.com).
9+
1. Install the run-time and build dependencies:
10+
```bash
11+
npm install
12+
```
13+
1. Tell Firebase to use your new project locally:
14+
```bash
15+
firebase use --add
16+
```
17+
1. Run the build script to transpile and pack the sources:
18+
```bash
19+
npm run build
20+
```
21+
1. Serve the app locally:
22+
```bash
23+
npm run serve
24+
```
25+
1. Try out the app by opening [http://localhost:5000](http://localhost:5000) in your browser.
2726

2827

2928
## Contributing

0 commit comments

Comments
 (0)