Commit ea78c498 authored by baesangjune's avatar baesangjune
Browse files

Merge remote-tracking branch 'origin/cherry' into BAE

parents c7c00c29 32ab85d9
...@@ -96,7 +96,7 @@ function App() { ...@@ -96,7 +96,7 @@ function App() {
<h3 class="mb-0">{recommend.name}</h3> <h3 class="mb-0">{recommend.name}</h3>
<Image variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={recommend.img} /> <Image variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={recommend.img} />
<p class="card-text mb-auto">{recommend.address}</p> <p class="card-text mb-auto">{recommend.address}</p>
<Link to={`/place?id=${1}&place=${recommend.name}`} > <Link to={`/place?name=${recommend.name}&src=${recommend.img}&address=${recommend.address}`} >
<Button variant="info"> {recommend.name} 자세히 살펴보기</Button> <Button variant="info"> {recommend.name} 자세히 살펴보기</Button>
</Link> </Link>
</div> </div>
...@@ -112,7 +112,7 @@ function App() { ...@@ -112,7 +112,7 @@ function App() {
<h3 class="mb-0">{latest.name}</h3> <h3 class="mb-0">{latest.name}</h3>
<Image variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={latest.img} /> <Image variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={latest.img} />
<p class="mb-auto">{latest.address}</p> <p class="mb-auto">{latest.address}</p>
<Link to={`/place?id=${1}&place=${latest.name}`} > <Link to={`/place?name=${latest.name}&src=${latest.img}&address=${latest.address}`} >
<Button variant="info"> {latest.name} 자세히 살펴보기</Button> <Button variant="info"> {latest.name} 자세히 살펴보기</Button>
</Link> </Link>
</div> </div>
......
...@@ -68,16 +68,7 @@ function Bookmark() { ...@@ -68,16 +68,7 @@ function Bookmark() {
return ( return (
<Container> <Container>
{/* <Link to="/" > <Link to="/"><Image style={{ margin: "1%" }} src={ohuh} /></Link>
<Image style={{ margin: "1%" }} src={ohuh} />
</Link>
<Navbar bg="info" variant="dark">
<Navbar.Brand href="/">북마크</Navbar.Brand>
<Nav className="mr-auto">
<Nav.Link href="/">Home</Nav.Link>
</Nav>
</Navbar> */}
<Link to="/" className="d-flex justify-content-center"><Image style={{ margin: "1%" }} src={ohuh} /></Link>
<div class="d-flex align-items-center p-3 text-white bg-info rounded shadow-sm"> <div class="d-flex align-items-center p-3 text-white bg-info rounded shadow-sm">
<div > <div >
<h1 class="h6 mb-0 text-white">북마크</h1> <h1 class="h6 mb-0 text-white">북마크</h1>
...@@ -104,7 +95,7 @@ function Bookmark() { ...@@ -104,7 +95,7 @@ function Bookmark() {
<Card.Body > <Card.Body >
<Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height: "80px" }} > <Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height: "80px" }} >
{place.address} </Card.Text> {place.address} </Card.Text>
<Link to={`/place?&place=${place.name}`} > <Link to={`/place?name=${place.name}&src=${place.img}&address=${place.address}`} >
<Button variant="info"> {place.name} 자세히 살펴보기</Button> <Button variant="info"> {place.name} 자세히 살펴보기</Button>
</Link> </Link>
</Card.Body> </Card.Body>
......
...@@ -7,7 +7,9 @@ import axios from 'axios'; ...@@ -7,7 +7,9 @@ import axios from 'axios';
import queryString from 'query-string' import queryString from 'query-string'
import * as Icon from 'react-bootstrap-icons'; import * as Icon from 'react-bootstrap-icons';
import { isAuthenticated } from '../utils/auth'; import { isAuthenticated } from '../utils/auth';
import catchErrors from '../utils/catchErrors' import catchErrors from '../utils/catchErrors';
import _ from 'lodash';
function Search(props) { function Search(props) {
...@@ -43,14 +45,8 @@ function Search(props) { ...@@ -43,14 +45,8 @@ function Search(props) {
} }
useEffect(() => { useEffect(() => {
if (association.length < 3) { setPagePlace(paginate(association, index, 4))
setPagePlace(paginate(association, index, association.length)) setEndPage(Math.ceil((association.length / 4)))
}
else {
setPagePlace(paginate(association, index, 4))
}
setEndPage(Math.floor((association.length / 4)))
}, [association, index]) }, [association, index])
useEffect(() => { useEffect(() => {
...@@ -59,21 +55,8 @@ function Search(props) { ...@@ -59,21 +55,8 @@ function Search(props) {
if (state) { if (state) {
props.history.push('/search?keyword=' + search) props.history.push('/search?keyword=' + search)
setState(false) setState(false)
} window.addEventListener("scroll", infiniteScroll);
return () => { window.removeEventListener("scroll", infiniteScroll); }
}, [state]);
const infiniteScroll = () => {
const { documentElement, body } = document;
const scrollHeight = Math.max(documentElement.scrollHeight, body.scrollHeight);
const scrollTop = Math.max(documentElement.scrollTop, body.scrollTop);
const clientHeight = documentElement.clientHeight;
if (scrollTop + clientHeight >= scrollHeight) {
// getReview();
console.log("더불러")
} }
console.log(scrollHeight, scrollTop, clientHeight) }, [state]);
}
const handlePage = (num) => { const handlePage = (num) => {
setIndex(num); setIndex(num);
...@@ -81,7 +64,6 @@ function Search(props) { ...@@ -81,7 +64,6 @@ function Search(props) {
console.log(index) console.log(index)
} }
const handleChange = (e) => { const handleChange = (e) => {
setSearch(e.target.value); setSearch(e.target.value);
} }
...@@ -94,14 +76,12 @@ function Search(props) { ...@@ -94,14 +76,12 @@ function Search(props) {
} }
function paginate(items, pageNumber, itemNumber) { function paginate(items, pageNumber, itemNumber) {
const page = [];
const startIndex = (pageNumber - 1) * itemNumber const startIndex = (pageNumber - 1) * itemNumber
for (var i = 0; i < itemNumber; i++) {
page.push(items[(startIndex + i)]) return _(items)
} .slice(startIndex)
console.log("뿌릴 data22222222222222222", page) .take(itemNumber)
return page .value();
} }
async function handlebookmark(index, place) { async function handlebookmark(index, place) {
...@@ -132,7 +112,7 @@ function Search(props) { ...@@ -132,7 +112,7 @@ function Search(props) {
} }
return ( return (
<Container > <Container >
<Link to="/" ><Image src={ohuh} /></Link> <Link to="/"><Image src={ohuh} /></Link>
<Row className="mb-2" className="d-flex justify-content-center"> <Row className="mb-2" className="d-flex justify-content-center">
<Form style={{ width: "90vw" }} onSubmit={handleSubmit}> <Form style={{ width: "90vw" }} onSubmit={handleSubmit}>
<InputGroup size="lg"> <InputGroup size="lg">
...@@ -172,7 +152,7 @@ function Search(props) { ...@@ -172,7 +152,7 @@ function Search(props) {
<Card.Body> <Card.Body>
<Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height: "80px" }} > <Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height: "80px" }} >
{place.address} </Card.Text> {place.address} </Card.Text>
<Link to={`/place?id=${index}&place=${place.name}`} > <Link to={`/place?name=${place.name}&src=${place.img}&address=${place.address}`} >
<Button variant="info"> {place.name} 자세히 살펴보기</Button> <Button variant="info"> {place.name} 자세히 살펴보기</Button>
</Link> </Link>
</Card.Body> </Card.Body>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment