Skip to content

Instantly share code, notes, and snippets.

@ac205
ac205 / App.css
Last active November 24, 2019 16:42
RBG Color Changer
.outsideContainer {
height: 90vh;
padding: 5vh;
margin: auto;
}
.container {
background: rgb(248, 248, 248);
width: 50%;
margin: auto;
text-align: center;
@ac205
ac205 / App.js
Last active November 24, 2019 16:42
Login Demo
import React, { useState } from 'react';
import Typography from '@material-ui/core/Typography';
import MyAppbar from './components/MyAppbar';
import MainContent from './components/MainContent';
const App = () => {
const [isLoggedIn, setIsLoggedIn] = useState(false);
return (
<div id="App">
@ac205
ac205 / App.css
Last active November 24, 2019 16:43
Weather App
#weatherContainer {
text-align: center;
}
#weatherCard {
text-align: center;
margin: 50px auto;
width: 100%;
}
@ac205
ac205 / CartReducer.jsx
Last active December 10, 2019 00:46
Cart 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);
})
@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);
})
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 / 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);
}
};
@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 / 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 / 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";