New API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"parser": "babel-eslint", | |
"plugins": [ | |
"react", | |
"react-native" | |
], | |
"parserOptions": { | |
"ecmaFeatures": { | |
"jsx": true, | |
"modules": true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serializeForm from 'form-serialize' | |
const getLocalStorage = (key) => { | |
let data = null | |
try { data = JSON.parse(localStorage[key]) } catch() {} | |
return data | |
} | |
const setLocalStorage = (key, data) => { | |
localStorage[key] = JSON.stringify(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import _set from 'lodash/set' | |
import _get from 'lodash/get' | |
const searchkit = new SearchkitManager(`/elastic/materials`, { | |
withCredentials: true | |
}) | |
class SearchApp extends SearchkitComponent { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import _debounce from 'lodash/debounce' | |
import _get from 'lodash/get' | |
import { | |
SearchkitComponent, | |
PageSizeAccessor | |
} from 'searchkit' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import extend from 'lodash/extend'; | |
import { SearchkitManager,SearchkitProvider, | |
SearchBox, Pagination, HitsStats, NoHits, ViewSwitcherHits, | |
Layout, TopBar, LayoutBody, LayoutResults, | |
ActionBar, ActionBarRow, QueryAccessor} from 'searchkit'; | |
import './index.css'; | |
import { | |
SearchkitAutosuggest, HierarchicalRefinementDatasource, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
import { render } from "react-dom"; | |
import "./index.css"; | |
class Widget extends Component { | |
state = { text: "" }; | |
handleChange = (e) => { | |
this.setState({ text: e.target.value }); | |
}; | |
render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const response = await fetch(`https://catappapi.herokuapp.com/users/${userId}`) | |
const data = await response.json() | |
return data.imageUrl | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set it up | |
firebase.storage().ref().constructor.prototype.putFiles = function(files) { | |
var ref = this; | |
return Promise.all(files.map(function(file) { | |
return ref.child(file.name).put(file); | |
})); | |
} | |
// use it! | |
firebase.storage().ref().putFiles(files).then(function(metadatas) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Object.keys(searchkit).map(key => | |
// console.log(searchkit[key]) | |
// ) | |
// for (var key in searchkit) { | |
// // skip loop if the property is from prototype | |
// if (!searchkit.hasOwnProperty(key)) continue; | |
// var obj = searchkit[key]; |