Skip to content

Instantly share code, notes, and snippets.

View PabloRegen's full-sized avatar
🏠
Working from home

Pablo Regen PabloRegen

🏠
Working from home
  • New York City
View GitHub Profile
@PabloRegen
PabloRegen / Slider.js
Last active March 4, 2019 23:53
Create a slider input
const Slider = ({ speed, onSpeedChange }) => {
const handleChange = e => onSpeedChange(e.target.value);
return (
<input
type='range'
min='50'
max='1000'
step='50'
value={speed}
@PabloRegen
PabloRegen / BoardGrid.js
Last active March 4, 2019 06:40
Create grid with a table
const BoardGrid = ({ boardStatus, onToggleCellStatus }) => {
const handleClick = (r,c) => onToggleCellStatus(r,c);
const tr = [];
for (let r = 0; r < totalBoardRows; r++) {
const td = [];
for (let c = 0; c < totalBoardColumns; c++) {
td.push(
<td
key={`${r},${c}`}
@PabloRegen
PabloRegen / settingApp.js
Last active March 4, 2019 04:54
Setting App.js file
import React, { Component } from 'react';
const totalBoardRows = 40;
const totalBoardColumns = 60;
const newBoardStatus = () => {};
const BoardGrid = () => {};
const Slider = () => {};
class App extends Component {
@PabloRegen
PabloRegen / newBoardStatus.js
Last active March 4, 2019 05:37
function to generate a board status
const newBoardStatus = (cellStatus = () => Math.random() < 0.3) => {
const grid = [];
for (let r = 0; r < totalBoardRows; r++) {
grid[r] = [];
for (let c = 0; c < totalBoardColumns; c++) {
grid[r][c] = cellStatus();
}
}
return grid;
};
/*
Components structure:
- App
- Title
- NewTaskBar
- UserDisplayPreference
- ViewBar
- OrderByBar
- SearchBar