-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move around the very basic components
- Loading branch information
Showing
24 changed files
with
98 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,35 @@ | ||
# React Native Standards | ||
<p align="center"><a href="https://github.com/kametventures/galette" target="_blank"> | ||
<img src="./assets/galette.png" height="50"> | ||
</a></p> | ||
|
||
A set of tools, components and screens that should not be re-written every single time. Built on the shoulders of React & Redux, | ||
these standards will get you up and running very fast. | ||
# Galette | ||
|
||
## Standards | ||
Galette is a set of tools, components and screens to be re-used within your applications. Built on the shoulders of | ||
React & Redux, these modules will get you up and running very fast. | ||
|
||
- Collection | ||
- Empty State | ||
## Modules | ||
|
||
## Specifics | ||
These modules are generic modules to be used both for React and React Native. Checkout bellow for React and React Native | ||
specific components that work well with these modules. | ||
|
||
- Infinite-Scroll-View | ||
- [**Store**](./modules/store)<br> | ||
Reducers, selectors and helpers to store your collections and items in your Redux store. | ||
|
||
- [**Hydra**](./modules/hydra)<br> | ||
Super-set of Store, adding specifics for Hydra APIs. | ||
|
||
- [**ram** (redux-api-middleware)](./modules/redux-api-middleware)<br> | ||
Superset of Store, adding specifics for redux-api-middleware. | ||
|
||
## React Web | ||
|
||
- [**TokenWall**](./web/token-wall)<br> | ||
Adding a simple token wall for your early prototype. | ||
|
||
## React Native | ||
|
||
- [**InfiniteScrollView**](./native/infinite-scroll-view)<br> | ||
An easy to use infinite scroll view for your paginated collections. | ||
|
||
- [**EmptyState**](./native/empty-state)<br> | ||
Set of screens to be used when nothing has been found. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ListView } from "react-native"; | ||
|
||
export class NativeCollection extends Collection | ||
{ | ||
dataSource() { | ||
let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}) | ||
let items = this.items(); | ||
|
||
return ds.cloneWithRows(items); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"name": "@galette/galette", | ||
"require": { | ||
"react-native-elements": "^0.18.4" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as React from 'react' | ||
import {Component} from "react"; | ||
import {getToken} from "../token"; | ||
|
||
export default class TokenEnforcementWall extends Component { | ||
render() { | ||
if (getToken()) { | ||
return this.props.children; | ||
} | ||
|
||
return ( | ||
<div> | ||
<h1>You need to be authenticated.</h1> | ||
<form method="get"> | ||
<p> | ||
<label>Token</label> | ||
<input type="text" name="access_token"/> | ||
</p> | ||
<p> | ||
<button type="submit">Login</button> | ||
</p> | ||
</form> | ||
</div> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const getParams = query => { | ||
if (!query) { | ||
return {}; | ||
} | ||
|
||
return (/^[?#]/.test(query) ? query.slice(1) : query) | ||
.split('&') | ||
.reduce((params, param) => { | ||
let [key, value] = param.split('='); | ||
params[key] = value ? decodeURIComponent(value.replace(/\+/g, ' ')) : ''; | ||
return params; | ||
}, {}); | ||
}; | ||
|
||
export const getToken = (): string => { | ||
let token: string = localStorage.getItem('token'); | ||
if (token) { | ||
return token; | ||
} | ||
|
||
token = getParams(document.location.search).access_token; | ||
if (token) { | ||
localStorage.setItem('token', token); | ||
|
||
// Refresh so that it looses the token | ||
window.location.href = window.location.origin; | ||
} | ||
|
||
return token; | ||
} |