Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added the ListSearchComponent #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
793 changes: 793 additions & 0 deletions data/data.json

Large diffs are not rendered by default.

8,570 changes: 6,206 additions & 2,364 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions public/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,14 @@ footer .nav-link i {
text-align: left;
}

.grid{
height: 75vh;
position: absolute;
z-index: 1;
top: 32px;
left: 25px;
}

.share-modal .link {
flex-grow: 100;
display: inline-block;
Expand Down
6 changes: 6 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import googleMapAPI from "../utils/googlemaps";
import debounce from "lodash.debounce";
import classnames from "classnames";
import {ShareModal} from "./components/ShareModal";
import {Grid} from "./components/Grid"

const translations = {
en: require("./translations/en.json"),
Expand Down Expand Up @@ -56,6 +57,10 @@ export function App({gmApiKey, gaTag}) {
const [isSlideUp, setIsSlideUp] = useState(false);
const [userToken, setUserToken] = useState(null);

console.log(results, "🌸");
console.log(cardData, "💕");


const handleSearchQuery = (query) => {
googleMapFn.search(query, searchResultCallback);
};
Expand Down Expand Up @@ -586,6 +591,7 @@ export function App({gmApiKey, gaTag}) {
{userToken && <Metrics/>}
<FunFacts/>
</div>
<Grid className="grid"/>
<div className="footer">
<div className="container-lg">
<footer>
Expand Down
76 changes: 76 additions & 0 deletions src/components/ListCard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
@font-face {
font-family: "Futura";
src: url("../assets/futura/Futura\ Light\ font.ttf");
}

.modal-card-container {
padding: 10px;
border-radius: 2%;

}
.modal-card-container:hover {
border: solid thin;
border-color: #2f97d1;
opacity: 70%;
}

.modal-card-picture {
height: 100px;
width: 100px;
background-color: antiquewhite;
border-radius: 5%;
}

.modal-card-contents {
display: flex;
flex-direction: row;
gap: 15px;
align-items: center;
}

.modal-card-details{
display:flex;
flex-direction: column;
}
.shop-list-name {
font-family: "Futura";
font-style: normal;
font-weight: 400;
font-size: 18px;
line-height: 23px;
display: flex;
align-items: flex-end;
color: #2f97d1;
}
.location-icon {
width: 20px;
fill: #f8b838;
margin-left: 5px;
margin-right: 5px;
}
.shop-list-body {
font-family: "Futura";
font-style: normal;
font-weight: 400;
font-size: 14px;
line-height: 18px;
color: #666666;
margin-left: 10px;
}

a:link {
text-decoration: none;
}

a:visited {
text-decoration: none;
}

a:hover {
text-decoration: none;
}

a:active {
text-decoration: none;
}

27 changes: 27 additions & 0 deletions src/components/ListCard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from "react";
import "./ListCard.css";
import locationButton from "/images/map-pin-gold.svg";

export const ListCard = ({ data }) => {
console.log(data.data);
const cardRender = data.data.map((info) => {
console.log(info);
return (
<div className="modal-card-container">
<a href={info.website}>
<div className="modal-card-contents">
<img src={info.photos[0].url} className="modal-card-picture" />
<div className="modal-card-details">
<p className="shop-list-name">
<img src={locationButton} className="location-icon" />
{info.name}
</p>
<p className="shop-list-body">{info.grouped_tags["Water"].map((item)=>{return `${item} `})}</p>
</div>
</div>
</a>
</div>
);
});
return <>{cardRender}</>;
};
8 changes: 8 additions & 0 deletions src/components/ListGrid.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.grid-container {
display: grid;
grid-template-columns: repeat(1, fr1);
gap: 10px;
width: 100%;

}

10 changes: 10 additions & 0 deletions src/components/ListGrid.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from "react";
import "./ListGrid.css";

export const Grid = ({children}) => {
return (
<div className="grid-container">
{children}
</div>
);
};
12 changes: 12 additions & 0 deletions src/components/ListModal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.modal-container {
height: 50vh;
z-index: 1;
position: absolute;
bottom: 5vh;
background-color: #ffffff;
box-shadow: 0px -4px 10px rgba(0, 0, 0, 0.2);
border-radius: 10px 10px 0px 0px;
padding: 20px;
overflow: scroll;
}

6 changes: 6 additions & 0 deletions src/components/ListModal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React, { useEffect, useState } from "react";
import "./ListModal.css";

export const ListModal = ( {children}) => {
return <div className="modal-container">{children}</div>;
};
33 changes: 33 additions & 0 deletions src/components/ListSearchComponent.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useState, useEffect } from "react";
import "./App.css";
import axios from "axios";
import { ListModal } from "./Components/ListModal";
import { ListCard } from "./Components/ListCard";
import { ListGrid } from "./Components/Grid";

function ListSearchComponent() {
const [data, setData] = useState();

//async function to dataSet
const getData = async () => {
await axios.get(`./data/data.json`).then((response) => {
setData(response.data);
});
};

//run get Data
useEffect(() => {
getData();
}, []);

return <div className="App">
<ListModal>
<ListGrid>
{data && <ListCard data={data}/>}
</ListGrid>
</ListModal>

</div>;
}

export default ListSearchComponent;
1 change: 0 additions & 1 deletion src/components/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export function Search({ results, onSearch, onReset }) {
const debounced = useDebouncedCallback(onSearch, 500, { leading: true });
const showResultInputs =
results.length > 0 ? "maps-location-search-input-with-results" : "";

const handleReset = () => {
inputRef.current.value = "";
onReset();
Expand Down
Loading