Skip to content

Instantly share code, notes, and snippets.

View blizzerand's full-sized avatar
👨‍💻
Inventing

Manjunath blizzerand

👨‍💻
Inventing
View GitHub Profile
REACT_APP_LOGIN="http://localhost:3030/api/auth/login"
REACT_APP_LOGOUT="http://localhost:3030/api/auth/logout"
DOMAIN="user4234.auth0.com"
ID="46NxlCzM0XDE7T2upOn2jlgvoS"
SECRET="0xbTbFK2y3DIMp2TdOgK1MKQ2vH2WRg2rv6jVrMhSX0T39e5_Kd4lmsFz"
SUCCESS_REDIRECT="http://localhost:3030/"
FAILURE_REDIRECT="http://localhost:3030/api/auth/login"
AWS_ACCESS_KEY_ID=AKSFDI4KL343K55L3
AWS_SECRET_ACCESS_KEY=EkjfDzVrG1cw6QFDK4kjKFUa2yEDmPOVzN553kAANcy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
handleCheckBox(e) {
const newSelection = e.target.value;
let newSelectionArray;
if(this.state.newUser.skills.indexOf(newSelection) > -1) {
newSelectionArray = this.state.newUser.skills.filter(s => s !== newSelection)
} else {
newSelectionArray = [...this.state.newUser.skills, newSelection];
}
/* FormContainer.jsx */
handleInput(e) {
let value = e.target.value;
let name = e.target.name;
this.setState( prevState => {
return {
newUser : {
...prevState.newUser, [name]: value
}
/*Button.jsx */
const Button = (props) => {
console.log(props.style);
return(
<button
style= {props.style}
onClick= {props.action}>
{props.title}
</button>)
}
const CheckBox = (props) => {
return( <div>
<label for={props.name} className="form-label">{props.title}</label>
<div className="checkbox-group">
{props.options.map(option => {
return (
<label key={option}>
<input
className="form-checkbox"
@blizzerand
blizzerand / Select.jsx
Created November 29, 2018 14:08
Select Form Element
/*Select.jsx*/
const Select = (props) => {
return(
<div className="form-group">
<label htmlFor={props.name}> {props.title} </label>
<select
name={props.name}
value={props.value}
onChange={props.handleChange}
@blizzerand
blizzerand / FormContainer.jsx
Created November 28, 2018 13:31
Form Container
import React, {Component} from 'react';
/* Import Presentational Components */
import CheckBox from '../components/CheckBox';
import Input from '../components/Input';
class FormContainer extends Component {
constructor(props) {
super(props);
@blizzerand
blizzerand / Form.js
Created November 28, 2018 10:13
Form Component
<form className="container" onSubmit={this.handleFormSubmit}>
<Input /> {/* Name of the user */}
<Input /> {/* Input for Age */}
<Select /> {/* Gender Selection */}
<CheckBox /> {/* List of Skills (eg. Programmer, developer) */}
<TextArea /> {/* About you */}
<Button /> { /*Submit */ }
<Button /> {/* Clear the form */}
</form>
@blizzerand
blizzerand / App.js
Created November 28, 2018 09:39
React forms - storylens
import React from 'react';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
data: 'Default data'
}
this.updateState = this.updateState.bind(this);