Skip to content

Commit 7243270

Browse files
authored
including readme in package
1 parent 1ff12e6 commit 7243270

File tree

5 files changed

+81
-60
lines changed

5 files changed

+81
-60
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog for `react-static-web-apps-auth`
22

3+
## [0.1.2]
4+
5+
Poking DevOps pipelines and setting README.
6+
37
## [0.1.0] - 2020-12-18
48

59
Initial Release 🎉

README.md

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -14,61 +14,4 @@ npm install @aaronpowell/react-static-web-apps-auth
1414

1515
Or you can install the latest build from GitHub packages.
1616

17-
## Usage
18-
19-
The package contains some components that wrap the functionality for you.
20-
21-
### `<StaticWebAppsAuthLogins />`
22-
23-
```typescript
24-
const Login = () => {
25-
return (
26-
<div>
27-
<h2>Login to our site</h2>
28-
<StaticWebAppsAuthLogins aad={false} />
29-
</div>
30-
);
31-
};
32-
```
33-
34-
This component will display all the auth providers you want to use on your application and links for the user.
35-
36-
By default all auth providers will display, but they can be turned off by setting their corresponding prop to `false`.
37-
38-
To redirect to a specific URL post-login, provide that path in the `postLoginRedirect` prop.
39-
40-
### `<UserInfoContextProvider>`
41-
42-
```typescript
43-
const App = () => {
44-
return (
45-
<UserInfoContextProvider>
46-
<MySite />
47-
</UserInfoContextProvider>
48-
);
49-
};
50-
```
51-
52-
This component provides React Context for the current user (or a series of `undefined` values when you're not logged in), aligning with the information available [in the Client Principal](https://docs.microsoft.com/azure/static-web-apps/user-information?tabs=javascript#client-principal-data&WT.mc_id=javascript-12079-aapowell).
53-
54-
Additionally, a `useContext` React Hook is available, `useUserInfo`, for use within the application.
55-
56-
### `<Logout />`
57-
58-
This component provides the logout function through Static Web Apps.
59-
60-
To redirect to a specific URL post-logout, provide the path in the `postLogoutRedirect` prop.
61-
62-
### `<UserPurge />`
63-
64-
This component provides the user with the ability to [remove their identifying information from Static Web Apps](https://docs.microsoft.com/azure/static-web-apps/authentication-authorization?WT.mc_id=javascript-12079-aapowell#remove-personal-identifying-information). By default it'll only purge them from the current domain, but set the `globally` prop to `true` if you with to give them the ability to completely remove themselves from Static Web Apps.
65-
66-
## Styling
67-
68-
Each of the components generates minimal HTML (a single `<a>` tag) to make it easier to style within an application. The DOM elements have the class `azure-swa-auth`, defined in `./constants` as `StaticWebAppsClassName`, on them, along with the component type, `login`, `logout` or `purge`.
69-
70-
Additionally, the login components have the provider as a class, so providers can be styled individually.
71-
72-
## License
73-
74-
MIT
17+
Learn more from the [README](./react-static-web-apps).

react-static-web-apps-auth/README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Static Web App Auth tools for React
2+
3+
![Node.js CI](https://github.com/aaronpowell/react-static-web-apps-auth/workflows/Node.js%20CI/badge.svg) | [![npm version](https://img.shields.io/npm/v/react-static-web-apps-auth)](https://npmjs.org/package/react-static-web-apps-auth)
4+
5+
This package is a series of helper tools for working with [Azure Static Web Apps](https://docs.microsoft.com/azure/static-web-apps/?WT.mc_id=javascript-12079-aapowell) [Authentication and Authorization](https://docs.microsoft.com/azure/static-web-apps/authentication-authorization?WT.mc_id=javascript-12079-aapowell) from React.
6+
7+
## Installation
8+
9+
You can install a stable release from npm:
10+
11+
```bash
12+
npm install @aaronpowell/react-static-web-apps-auth
13+
```
14+
15+
Or you can install the latest build from GitHub packages.
16+
17+
## Usage
18+
19+
The package contains some components that wrap the functionality for you.
20+
21+
### `<StaticWebAppsAuthLogins />`
22+
23+
```typescript
24+
const Login = () => {
25+
return (
26+
<div>
27+
<h2>Login to our site</h2>
28+
<StaticWebAppsAuthLogins aad={false} />
29+
</div>
30+
);
31+
};
32+
```
33+
34+
This component will display all the auth providers you want to use on your application and links for the user.
35+
36+
By default all auth providers will display, but they can be turned off by setting their corresponding prop to `false`.
37+
38+
To redirect to a specific URL post-login, provide that path in the `postLoginRedirect` prop.
39+
40+
### `<UserInfoContextProvider>`
41+
42+
```typescript
43+
const App = () => {
44+
return (
45+
<UserInfoContextProvider>
46+
<MySite />
47+
</UserInfoContextProvider>
48+
);
49+
};
50+
```
51+
52+
This component provides React Context for the current user (or a series of `undefined` values when you're not logged in), aligning with the information available [in the Client Principal](https://docs.microsoft.com/azure/static-web-apps/user-information?tabs=javascript#client-principal-data&WT.mc_id=javascript-12079-aapowell).
53+
54+
Additionally, a `useContext` React Hook is available, `useUserInfo`, for use within the application.
55+
56+
### `<Logout />`
57+
58+
This component provides the logout function through Static Web Apps.
59+
60+
To redirect to a specific URL post-logout, provide the path in the `postLogoutRedirect` prop.
61+
62+
### `<UserPurge />`
63+
64+
This component provides the user with the ability to [remove their identifying information from Static Web Apps](https://docs.microsoft.com/azure/static-web-apps/authentication-authorization?WT.mc_id=javascript-12079-aapowell#remove-personal-identifying-information). By default it'll only purge them from the current domain, but set the `globally` prop to `true` if you with to give them the ability to completely remove themselves from Static Web Apps.
65+
66+
## Styling
67+
68+
Each of the components generates minimal HTML (a single `<a>` tag) to make it easier to style within an application. The DOM elements have the class `azure-swa-auth`, defined in `./constants` as `StaticWebAppsClassName`, on them, along with the component type, `login`, `logout` or `purge`.
69+
70+
Additionally, the login components have the provider as a class, so providers can be styled individually.
71+
72+
## License
73+
74+
MIT

react-static-web-apps-auth/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react-static-web-apps-auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aaronpowell/react-static-web-apps-auth",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "A library to help creating authenticated React apps on Azure Static Web Apps",
55
"main": "build/index.js",
66
"types": "build/index.d.ts",

0 commit comments

Comments
 (0)