Skip to content

Commit

Permalink
Merge pull request #19 from delicious-algorithme/dev
Browse files Browse the repository at this point in the history
feat : clickable 구현
  • Loading branch information
Songhyejeong authored Aug 19, 2024
2 parents 75e6559 + 9e218d1 commit c8276cc
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 173 deletions.
71 changes: 1 addition & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.

The page will reload when you make changes.\
You may also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can't go back!**

If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)

### Analyzing the Bundle Size

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `npm run build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
### MATAL-Frontend
11 changes: 8 additions & 3 deletions src/components/common/Category.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ const items = [

const Category = (position) => {
const navigate = useNavigate();
const onClickHandler = () => {
navigate('/webmap/storeList/1'); //임시 경로
const onClickHandler = (idx) => {
navigate(`/webmap/storeList/${idx}`, { state: { listVisible: true } }); //임시 경로
};
return (
<CategoryLayout position={position}>
{items.map((item, idx) => {
return (
<div key={idx} onClick={onClickHandler}>
<div
key={idx}
onClick={(idx) => {
onClickHandler(idx);
}}
>
{item}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const MyMap = () => {
};
const markerClickHandler = useCallback(
(id) => {
navigate(`/webmap/storeDetail/${id}`);
navigate(`/webmap/storeDetail/${id}`, { state: { detailVisible: true } });
},
[navigate]
);
Expand Down
18 changes: 16 additions & 2 deletions src/components/common/MobileNav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@ import styled from 'styled-components';
import { Orange, White } from '../../color';
import { ReactComponent as HomeIcon } from '../../assets/Icon/Home.svg';
import { ReactComponent as CategoryIcon } from '../../assets/Icon/Category.svg';
import { useNavigate } from 'react-router-dom';
import { useState } from 'react';
const MobileNav = () => {
const navigate = useNavigate();
const [visible, setVisible] = useState(false);
const homeNavClickHandler = () => {
navigate('/');
};
const categoryClickhandler = () => {
const newVisible = !visible;
setVisible(newVisible);
navigate('/webmap', { state: { visible: newVisible } });
};
return (
<MobileNavLayout>
<HomeNav>
<HomeNav onClick={homeNavClickHandler}>
<HomeIcon />
</HomeNav>
<CategoryNav>
<CategoryNav onClick={categoryClickhandler}>
<CategoryIcon />
</CategoryNav>
</MobileNavLayout>
Expand Down Expand Up @@ -38,7 +50,9 @@ const MobileNavLayout = styled.div`
`;
const HomeNav = styled.div`
margin-left: 20px;
cursor: pointer;
`;
const CategoryNav = styled.div`
margin-right: 20px;
cursor: pointer;
`;
11 changes: 10 additions & 1 deletion src/components/common/StoreCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ import { ReactComponent as Path } from '../../assets/Icon/Path.svg';
import { ReactComponent as PathMobile } from '../../assets/Icon/Path_Mobile.svg';

import { ReactComponent as Star } from '../../assets/Icon/Star.svg';
import { useNavigate } from 'react-router-dom';
const StoreCard = () => {
const navigate = useNavigate();
const cardClickHandler = () => {
navigate('/webmap/storeDetail/1', { state: { detailVisible: true } });
};
return (
<StoreCardLayout>
<ImgBox>
<img src="/images/default-food.jpg" alt="맛집 대표 사진" />
</ImgBox>
<ContentsBox>
<NameAndPath>
<p>맛있는 알고리즘</p>
<Name onClick={cardClickHandler}>맛있는 알고리즘</Name>
<button>
<Path />
경로
Expand Down Expand Up @@ -135,3 +140,7 @@ const Rating = styled.div`
justify-content: flex-start;
align-items: center;
`;

const Name = styled.p`
cursor: pointer;
`;
175 changes: 95 additions & 80 deletions src/components/common/StoreDetail.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import styled from 'styled-components';
import { DartkGrey, Grey, Orange, White } from '../../color';
import React from 'react';
import React, { useState, useEffect } from 'react';
import { useLocation } from 'react-router-dom';
import { ReactComponent as Path } from '../../assets/Icon/Path.svg';
import { ReactComponent as Star } from '../../assets/Icon/Star.svg';
import { ReactComponent as Close } from '../../assets/Icon/Close.svg';
Expand Down Expand Up @@ -35,88 +36,101 @@ const data = {
};

const StoreDetail = () => {
const location = useLocation();
const [visible, setVisible] = useState(true);
useEffect(() => {
if (location.state?.detailVisible) {
setVisible(true);
}
}, [location.state]);
const closeHandler = () => {
setVisible(false);
//console.log(visible);
};
return (
<StoreContainer>
<CloseBox>
<Close />
</CloseBox>
<StoreMainBox>
<Image>
<img src="/images/default-food.jpg" alt="맛집 대표 사진" />
</Image>
<NameAndOters>
<NameAndPath>
<div>{data.name}</div>
<button>
<Path />
경로
</button>
<PathMobile />
</NameAndPath>
<CategoryAndReviewCount>
<Content>{data.category}</Content>
visible && (
<StoreContainer>
<CloseBox onClick={closeHandler}>
<Close />
</CloseBox>
<StoreMainBox>
<Image>
<img src="/images/default-food.jpg" alt="맛집 대표 사진" />
</Image>
<NameAndOters>
<NameAndPath>
<div>{data.name}</div>
<button>
<Path />
경로
</button>
<PathMobile />
</NameAndPath>
<CategoryAndReviewCount>
<Content>{data.category}</Content>
<div>
<Title>리뷰:</Title>
<Content>{data.reviewCount}</Content>
</div>
</CategoryAndReviewCount>
<Rating>
<Title>별점:</Title>
<Star />
<Content>{data.rating}</Content>
</Rating>
<KeywordMobile>
<p>AI 분석 긍정 키워드</p>
<p>{data.positiveKeywords}</p>
</KeywordMobile>
</NameAndOters>
</StoreMainBox>
<StoreDetailAndReviewNav>
<div>개요</div>
<div>리뷰</div>
</StoreDetailAndReviewNav>
<StoreDetailContainer>
<StoreDetailBox>
<div>
<Title>주소: </Title>
<Content>{data.address}</Content>
</div>
<div>
<Title>전화번호: </Title>
<Content>{data.phone}</Content>
</div>
<div>
<Title>리뷰:</Title>
<Content>{data.reviewCount}</Content>
<Title>
영업시간:
<SeeMore />
</Title>
<Hours>
{data.businessHours &&
data.businessHours.map((item, idx) => {
return <div key={idx}>{item}</div>;
})}
</Hours>
</div>
</CategoryAndReviewCount>
<Rating>
<Title>별점:</Title>
<Star />
<Content>{data.rating}</Content>
</Rating>
<KeywordMobile>
<p>AI 분석 긍정 키워드</p>
<p>{data.positiveKeywords}</p>
</KeywordMobile>
</NameAndOters>
</StoreMainBox>
<StoreDetailAndReviewNav>
<div>개요</div>
<div>리뷰</div>
</StoreDetailAndReviewNav>
<StoreDetailContainer>
<StoreDetailBox>
<div>
<Title>주소: </Title>
<Content>{data.address}</Content>
</div>
<div>
<Title>전화번호: </Title>
<Content>{data.phone}</Content>
</div>
<div>
<Title>
영업시간:
<SeeMore />
</Title>
<Hours>
{data.businessHours &&
data.businessHours.map((item, idx) => {
return <div key={idx}>{item}</div>;
})}
</Hours>
</div>
</StoreDetailBox>
<StoreReviewBox>
<ReviewDetail>
<Keyword>
<Title>AI 분석 긍정 키워드</Title>
<span>{data.positiveKeywords}</span>
</Keyword>
<Title>AI분석 결과</Title>
<Content>{data.reviewSummary}</Content>
</ReviewDetail>
<ReviewRating>
<Title>긍정/부정 리뷰 비율</Title>
<RatingBar ratio={data.positiveRatio}>
<div />
</RatingBar>
<Content>이 식당의 긍정 리뷰 비율은 {data.positiveRatio}%입니다.</Content>
</ReviewRating>
</StoreReviewBox>
</StoreDetailContainer>
</StoreContainer>
</StoreDetailBox>
<StoreReviewBox>
<ReviewDetail>
<Keyword>
<Title>AI 분석 긍정 키워드</Title>
<span>{data.positiveKeywords}</span>
</Keyword>
<Title>AI분석 결과</Title>
<Content>{data.reviewSummary}</Content>
</ReviewDetail>
<ReviewRating>
<Title>긍정/부정 리뷰 비율</Title>
<RatingBar ratio={data.positiveRatio}>
<div />
</RatingBar>
<Content>이 식당의 긍정 리뷰 비율은 {data.positiveRatio}%입니다.</Content>
</ReviewRating>
</StoreReviewBox>
</StoreDetailContainer>
</StoreContainer>
)
);
};
export default StoreDetail;
Expand Down Expand Up @@ -154,6 +168,7 @@ const CloseBox = styled.div`
position: absolute;
right: 5px;
top: 5px;
cursor: pointer;
`;
const StoreMainBox = styled.div`
display: flex;
Expand Down
9 changes: 7 additions & 2 deletions src/components/main/MainHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import { ReactComponent as Game } from '../../assets/Icon/Game.svg';
import { ReactComponent as ArrowRight } from '../../assets/Icon/ArrowNav.svg';

import { Orange } from '../../color';
import { useNavigate } from 'react-router-dom';
const MainHeader = () => {
const navigate = useNavigate();
const dashboardClickHandler = () => {
navigate('/webmap/storeList/1');
};
return (
<MainHeaderLayout>
<SearchBarAndNav>
Expand All @@ -17,10 +22,10 @@ const MainHeader = () => {
</SearchBarBox>
<Nav>
<DashBoard />
<p>대시보드</p>
<p onClick={dashboardClickHandler}>대시보드</p>
<ArrowRight />
<Game />
<p>top 100</p>
<p onClick={dashboardClickHandler}>top 100</p>
</Nav>
</SearchBarAndNav>
<User />
Expand Down
Loading

0 comments on commit c8276cc

Please sign in to comment.