mirror of
https://github.com/gosticks/react-table.git
synced 2026-03-30 17:34:30 +00:00
Fixes and Readme updates
This commit is contained in:
@@ -33,10 +33,10 @@ html
|
||||
min-height 100vh
|
||||
|
||||
body
|
||||
background $clr-jumpsuit1
|
||||
background radial-gradient(ellipse at center, $clr-jumpsuit2 0%, $clr-jumpsuit1 100%)
|
||||
font-family $fnt-open-sans
|
||||
font-weight 300
|
||||
background: $clr-jumpsuit1
|
||||
background: radial-gradient(ellipse at center, $clr-jumpsuit2 0%, $clr-jumpsuit1 100%)
|
||||
font-family: $fnt-open-sans
|
||||
font-weight: 300
|
||||
padding-bottom: 50px
|
||||
|
||||
h1
|
||||
|
||||
@@ -15,14 +15,20 @@ export default Component({
|
||||
})
|
||||
|
||||
const columns = [{
|
||||
header: 'First Name',
|
||||
accessor: 'firstName'
|
||||
header: 'Name',
|
||||
columns: [{
|
||||
header: 'First Name',
|
||||
accessor: 'firstName'
|
||||
}, {
|
||||
header: 'Last Name',
|
||||
accessor: 'lastName'
|
||||
}]
|
||||
}, {
|
||||
header: 'Last Name',
|
||||
accessor: 'lastName'
|
||||
}, {
|
||||
header: 'Age',
|
||||
accessor: 'age'
|
||||
header: 'Info',
|
||||
columns: [{
|
||||
header: 'Age',
|
||||
accessor: 'age'
|
||||
}]
|
||||
}]
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
import { State } from 'jumpsuit'
|
||||
import _ from 'lodash'
|
||||
import axios from 'axios'
|
||||
|
||||
const githubState = State('counter', {
|
||||
initial: {
|
||||
search: null,
|
||||
loading: false,
|
||||
user: {}
|
||||
},
|
||||
|
||||
updateSearch: (state, payload) => ({
|
||||
search: payload,
|
||||
loading: true
|
||||
}),
|
||||
|
||||
receiveUser: (state, payload) => ({
|
||||
user: payload,
|
||||
loading: false
|
||||
})
|
||||
})
|
||||
|
||||
export default githubState
|
||||
|
||||
const getUserDebounced = _.debounce((username) => {
|
||||
axios.get(`https://api.github.com/users/${username}`)
|
||||
.then(({ data }) => {
|
||||
githubState.receiveUser(data)
|
||||
})
|
||||
.catch((err) => {
|
||||
githubState.receiveUser({})
|
||||
console.error(err)
|
||||
})
|
||||
}, 1000)
|
||||
|
||||
export function getUser (username) {
|
||||
githubState.updateSearch(username)
|
||||
if (username) getUserDebounced(username)
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
import github from './github'
|
||||
|
||||
export default { github }
|
||||
Reference in New Issue
Block a user