SSH into AWS ec2/ Digitalocean droplet/ or else other PAAS, linux machine
- Install Docker
$sudo apt install docker.io
$sudo usermod -aG docker $USER
I already installed docker
multiPropsFilter = (products, filters) => { | |
const filterKeys = Object.keys(filters); | |
return products.filter(product => { | |
return filterKeys.every(key => { | |
if (!filters[key].length) return true; | |
// Loops again if product[key] is an array (for material attribute). | |
if (Array.isArray(product[key])) { | |
return product[key].some(keyEle => filters[key].includes(keyEle)); | |
} | |
return filters[key].includes(product[key]); |
const collectedTrueKeys = { | |
color: ['white', 'pink'], | |
gender: ['girl'], | |
material: ['cotton'], | |
cateogry: [] | |
} |
// **************** Collect all keys and Filter **************** | |
// This function collects ALL keys that have true as a value, then create a new obj to compare to filter. | |
filteredCollected = () => { | |
const collectedTrueKeys = { | |
color: [], | |
gender: [], | |
material: [], | |
category: [] | |
}; | |
const { color, gender, material, category } = this.state.passingTags; |
// **************** UNIVERSAL Filter **************** | |
allFilterClickListener = (e, filterProp) => { | |
console.log("FILTER clicked", e.target.dataset.name); | |
const name = e.target.dataset.name; | |
this.setState(prevState => ({ | |
passingTags: { | |
...prevState.passingTags, | |
[filterProp]: { | |
...prevState.passingTags[filterProp], | |
[name]: !prevState.passingTags[filterProp][name] |
state = { | |
userInputContainerClicked: false, | |
searchTerm: "", | |
// tags that render are inside of 'passingTags' object. | |
passingTags: { | |
search: { | |
inputTerm: "" | |
}, | |
price: { | |
lowHigh: false, |
import React, { Component } from "react"; | |
class InputTagCollection extends Component { | |
render() { | |
console.log(this.props.tags); | |
const { search, price, color, gender, material, category } = this.props.tags; | |
return ( | |
<div id="chosen-tags"> | |
{search.inputTerm.length ? ( | |
<div className="collection" onClick={this.props.cancelSearchTag}> |
const category = ['innerwear', 'dress', 'robe', 'pajamas', 'sweater', 'pants']; | |
const color = ['white', 'black', 'brown', 'navy', 'blue', 'yellow', 'pink', 'purple', 'beige', 'red', 'green']; | |
const gender = ['unisex', 'girl', 'boy']; | |
const material = ['modal', 'cotton', 'spandex', 'tencel', 'rayon']; |
const sampleArray1 = [1, 2, 3]; | |
const sampleArray2 = ['apple', 'banana', 'cake']; | |
const result1 = sampleArray1.filter(number => number > 1); | |
const result2 = sampleArray2.filter(letter => letter.length > 4); | |
console.log(result1); | |
// => expected output: Array [2, 3] | |
console.log(result2); | |
// => expected output: Array ['apple', 'banana'] |
Verifying my Blockstack ID is secured with the address 12u9ToF8YchQMYt9ZCcYFPJYATJHXrURKE https://explorer.blockstack.org/address/12u9ToF8YchQMYt9ZCcYFPJYATJHXrURKE |
SSH into AWS ec2/ Digitalocean droplet/ or else other PAAS, linux machine
$sudo apt install docker.io
$sudo usermod -aG docker $USER
I already installed docker