Skip to content

Instantly share code, notes, and snippets.

@ac205
ac205 / workoutapp.js
Created March 23, 2020 16:02
Google Auth
import React, { useState, useEffect, Fragment } from 'react';
import './App.css';
import Topbar from './components/Topbar';
import Sidebar from './components/Sidebar';
import MainWindow from './components/MainWindow';
import BottomBar from './components/Bottombar';
import Messages from './components/Messages';
import Timer from './components/Timer';
import History from './components/History';
import EditExercise from './components/EditExercise';
@ac205
ac205 / router.jsx
Created February 18, 2020 13:35
React Router Example
const ReactTransactAdmin = ({ match }) => (
<div>
<AdminAppbar />
<AdminMenu />
<Route path={match.url} exact component={AdminPanel} />
<Route path={match.url + "/HeroImages"} component={HeroImages} />
<Route path={match.url + "/features"} component={Features} />
<Route path={match.url + "/salebar"} component={SaleBar} />
<Route path={match.url + "/categories"} component={Categories} />
<Route path={match.url + "/products"} component={Products} />
@ac205
ac205 / router.jsx
Created February 18, 2020 00:27
React Router Help
<Router>
{/* Admin Panel Routes */}
<AdminAppbar />
<AdminMenu />
<Switch>
<Route path="/admin/HeroImages" component={HeroImages} />
<Route path="/admin/features" component={Features} />
<Route path="/admin/salebar" component={SaleBar} />
<Route path="/admin/categories" component={Categories} />
<Route path="/admin/products" component={Products} />
@ac205
ac205 / cartReducer.js
Created February 8, 2020 01:34
Firebase - Redux
import productsList from "../dummyData/productsDummyData";
const initState = {
products: productsList,
count: 1,
cartContents: [],
confirmDelete: {
open: false,
id: null
},
@ac205
ac205 / RatingFilter.jsx
Created January 25, 2020 15:46
Shopping Filters
import React from "react";
import { connect } from "react-redux";
import {
makeStyles,
Grid,
Typography,
FormControlLabel,
Checkbox
} from "@material-ui/core";
import Rating from "@material-ui/lab/Rating";
@ac205
ac205 / action.js
Created January 19, 2020 04:28
SaleBar
case "SET_SALEBAR_DATA":
action.payload.num === 1
? (state = {
...state,
saleBar: [...state.saleBar[0], action.payload.data]
})
: action.payload.num === 2
? (state = {
...state,
saleBar: [...state.saleBar[1], action.payload.data]
@ac205
ac205 / SVG Issue.jsx
Created January 18, 2020 17:16
SVG Issue
<Typography paragraph>BACKGROUND SETTINGS</Typography>
<InputLabel id="background">Background</InputLabel>
<Select
labelId="background"
id="background"
onChange={handleBackground}
value={bgID}
>
<MenuItem value={0} id={`url("data:image/svg+xml,%3Csvg width='180' height='180' viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M81.28 88H68.413l19.298 19.298L81.28 88zm2.107 0h13.226L90 107.838 83.387 88zm15.334 0h12.866l-19.298 19.298L98.72 88zm-32.927-2.207L73.586 78h32.827l.5.5 7.294 7.293L115.414 87l-24.707 24.707-.707.707L64.586 87l1.207-1.207zm2.62.207L74 80.414 79.586 86H68.414zm16 0L90 80.414 95.586 86H84.414zm16 0L106 80.414 111.586 86h-11.172zm-8-6h11.173L98 85.586 92.414 80zM82 85.586L87.586 80H76.414L82 85.586zM17.414 0L.707 16.707 0 17.414V0h17.414zM4.28 0L0 12.838V0h4.28zm10.306 0L2.288 12.298 6.388 0h8.198zM180 17.414L162.586 0H180v17.414zM165.414 0l12.298 12.298L173.612 0h-8.198zM180 12.838
@ac205
ac205 / ImageUpload.jsx
Created January 13, 2020 00:45
FB/Redux Help
import React from "react";
import { connect } from "react-redux";
const ImageUpload = ({ url, progress, handleImgUpload }) => {
const handleChange = e => {
if (e.target.files[0]) {
const image = e.target.files[0];
handleImgUpload(image);
}
};
const cartReducer = (state = {
cartItems: 0,
items: products,
cartContents: [],
}, action) => {
switch (action.type) {
case "ADD_TO_CART":
{
const existingItem = state.cartContents.find(item => {
return item.id === Number(action.payload);
@ac205
ac205 / subtract.jsx
Last active December 10, 2019 13:30
Subtract Reducer
const cartReducer = (state = {
cartItems: 0,
items: products,
cartContents: [],
}, action) => {
switch (action.type) {
case "ADD_TO_CART": {
const existingItem = state.cartContents.find(item => {
return item.id === Number(action.payload);
})