Install eslint and prettier.
This commit is contained in:
@@ -1,24 +1,29 @@
|
||||
import React, { useState, useEffect } from "react"
|
||||
import { graphql } from 'gatsby'
|
||||
import { graphql } from "gatsby"
|
||||
|
||||
import Layout from "../components/layout"
|
||||
import SEO from "../components/seo"
|
||||
import BookCard from "../components/bookcard"
|
||||
import SideBar from "../components/sidebar";
|
||||
import {Container, Row, Col} from 'react-bootstrap';
|
||||
import BookFeed from "../components/feed";
|
||||
import SideBar from "../components/sidebar"
|
||||
import { Container, Row, Col } from "react-bootstrap"
|
||||
import BookFeed from "../components/feed"
|
||||
|
||||
function myFunction(setMaximumBooksToShow, maximumBooksToShow) {
|
||||
if (document.documentElement.clientHeight+document.documentElement.scrollTop>=document.documentElement.scrollHeight) {
|
||||
if (
|
||||
document.documentElement.clientHeight +
|
||||
document.documentElement.scrollTop >=
|
||||
document.documentElement.scrollHeight
|
||||
) {
|
||||
setMaximumBooksToShow(maximumBooksToShow + 12)
|
||||
}
|
||||
}
|
||||
|
||||
export default ({data}) => {
|
||||
let [maximumBooksToShow, setMaximumBooksToShow] = useState(12);
|
||||
useEffect(()=>{
|
||||
window.document.onscroll = () => myFunction(setMaximumBooksToShow, maximumBooksToShow);
|
||||
})
|
||||
export default ({ data }) => {
|
||||
let [maximumBooksToShow, setMaximumBooksToShow] = useState(12)
|
||||
useEffect(() => {
|
||||
window.document.onscroll = () =>
|
||||
myFunction(setMaximumBooksToShow, maximumBooksToShow)
|
||||
})
|
||||
return (
|
||||
<Layout>
|
||||
<SEO title="Home" />
|
||||
@@ -28,7 +33,7 @@ export default ({data}) => {
|
||||
<SideBar />
|
||||
</Col>
|
||||
<Col>
|
||||
<BookFeed data={data} limit={maximumBooksToShow} />
|
||||
<BookFeed data={data} limit={maximumBooksToShow} />
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
||||
@@ -36,19 +41,20 @@ export default ({data}) => {
|
||||
)
|
||||
}
|
||||
|
||||
export const query = graphql`query MyQuery {
|
||||
allBooksJson {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
title
|
||||
url
|
||||
rating
|
||||
author
|
||||
year
|
||||
category
|
||||
export const query = graphql`
|
||||
query MyQuery {
|
||||
allBooksJson {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
title
|
||||
url
|
||||
rating
|
||||
author
|
||||
year
|
||||
category
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user