Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/RE-BON/ReBoN into fe/style/l…
Browse files Browse the repository at this point in the history
…ogin
  • Loading branch information
hagus99 committed Jun 30, 2022
2 parents 3f945eb + 50c265f commit 0bd7c21
Show file tree
Hide file tree
Showing 58 changed files with 19,108 additions and 450 deletions.
17,610 changes: 17,558 additions & 52 deletions FrontEnd/rebon-frontend/package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions FrontEnd/rebon-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"react-router-dom": "6.2.2",
"react-scripts": "5.0.0",
"react-slick": "0.28.1",
"react-toggle": "4.1.2",
"react-toggle": "^4.1.2",
"styled-components": "^5.3.5",
"styled-react-modal": "^3.0.0",
"web-vitals": "2.1.4"
Expand All @@ -40,7 +40,8 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"deploy": "aws s3 sync ./build s3://rebon --profile=rebon"
},
"eslintConfig": {
"extends": [
Expand Down
Binary file added FrontEnd/rebon-frontend/public/image/Edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FrontEnd/rebon-frontend/public/image/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions FrontEnd/rebon-frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />

<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Jua&display=swap" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />

<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down Expand Up @@ -37,6 +43,8 @@
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src="https://developers.kakao.com/sdk/js/kakao.js"></script>

<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
1 change: 1 addition & 0 deletions FrontEnd/rebon-frontend/src/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
import Router from './Router';
import './styles/common.css';

function App() {
return (
Expand Down
1 change: 1 addition & 0 deletions FrontEnd/rebon-frontend/src/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function Router() {
<Route path="/join" element={<Join />} />
<Route path="/join/register" element={<Register />} />
<Route path="/logout" element={<Logout />} />
<Route path="/login" element={<Login />} />
<Route path="/terms" element={<Terms />} />
<Route path="/termsModal" element={<TermsModal />} />
<Route path="/marketing" element={<TermsMarketing />} />
Expand Down
27 changes: 21 additions & 6 deletions FrontEnd/rebon-frontend/src/components/Header/SearchModal/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import styled from 'styled-components';
import Modal, { ModalProvider, BaseModalBackground } from 'styled-react-modal';

import SearchBar from './SearchBar';
import axios from 'axios';
import '../../../styles/header-search-modal.css';

export default function SearchModal() {
Expand All @@ -27,6 +28,19 @@ export default function SearchModal() {
});
}

const [tag, setTags] = useState([]);
useEffect(() => {
axios
.get('http://34.238.48.93:8080/api/tags')
.then((response) => {
setTags(response.data);
console.log(tag[8]);
})
.catch((error) => {
console.log('error');
});
}, []);

const FadingBackground = styled(BaseModalBackground)`
opacity: ${(props) => props.opacity};
transition: all 0.3s ease-in-out;
Expand Down Expand Up @@ -62,10 +76,11 @@ export default function SearchModal() {

<ul className="header-tag-list">
<div>추천 태그로 검색해보세요.</div>
<li> 영일대</li>
<li>양덕</li>
<li>구룡포</li>
<li>칠포해수욕장</li>
{tag.slice(0, 10).map((item) => (
<Link to={`/main?name=${item.name}`} state={{ item }}>
<li>{item.name}</li>
</Link>
))}
</ul>
</div>
</StyledModal>
Expand Down
44 changes: 31 additions & 13 deletions FrontEnd/rebon-frontend/src/components/Header/index.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,50 @@
import '../../styles/header.css';
import React, { useState } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faCircleUser } from '@fortawesome/free-solid-svg-icons';
import React, { useState, useEffect } from 'react';
import { Link, useLocation } from 'react-router-dom';
import SearchModal from './SearchModal';
export default function Header() {
const [isLogin, setIsLogin] = useState(false);
let headerLocation = useLocation();
const userName = localStorage.getItem('userName');
//로그인인지 아닌지에 따라 헤더 상태 다름
const [isLogin, setIsLogin] = useState(true);
function Login(e) {
setIsLogin(true);
}

const [headerState, setHeaderState] = useState({ bgColor: 'white', bottomLine: '#E9E9EA' });
useEffect(() => {
if (headerLocation.pathname === '/') {
setHeaderState({ bgColor: 'transparent', bottomLine: '#ff6b6c' });
}
}, [headerLocation]);

return (
<div className="header-wrapper">
<div className="header-wrapper" style={{ backgroundColor: headerState.bgColor, borderBottomColor: headerState.bottomLine }}>
<header>
<div className="header-logo"></div>
<Link to="/">
<img src="./image/logo.png" alt="logo" />
</Link>
{isLogin ? (
<div className="header-logon">
<div className="header-logon-modal">
<SearchModal />
</div>
<div className="header-logon-icon">
<img src="image/user.png" />
</div>
<span>홍길동</span>

<Link to="/mypage" style={{ color: 'inherit', textDecoration: 'none' }}>
<div className="header-logon-icon">
<img src="./image/user.png" alt="user" />
{userName}
</div>
</Link>
</div>
) : (
<div onClick={Login} className="header-logoff">
<span>로그인</span>
<span>회원가입</span>
<div className="header-logoff">
<Link to="/login" style={{ color: 'inherit', textDecoration: 'none' }}>
<div>로그인</div>
</Link>
<Link to="/join" style={{ color: 'inherit', textDecoration: 'none' }}>
<div> 회원가입</div>
</Link>
</div>
)}
</header>
Expand Down
2 changes: 1 addition & 1 deletion FrontEnd/rebon-frontend/src/pages/Detail/Map/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function Map({ searchPlace }) {
id="myMap"
style={{
width: '500px',
height: '500px',
height: '300px',
}}
></div>
);
Expand Down
219 changes: 219 additions & 0 deletions FrontEnd/rebon-frontend/src/pages/Detail/Review/ReviewContent/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
import React, { useState, useLayoutEffect } from 'react';
import styled from 'styled-components';
import Modal, { ModalProvider, BaseModalBackground } from 'styled-react-modal';
import { faXmark } from '@fortawesome/free-solid-svg-icons';
// import SearchBar from './SearchBar';
import { Link } from 'react-router-dom';

import { Dropdown, Image, Row, Col, Table, Button } from 'react-bootstrap';
import { MoreVertical, Trash, Edit, AlertOctagon, X } from 'react-feather';
import { faCircleUser, faShareNodes, faEllipsisVertical } from '@fortawesome/free-solid-svg-icons';
import { faHeart as regularHeart, faPenToSquare } from '@fortawesome/free-regular-svg-icons';
import { faHeart as solidHeart } from '@fortawesome/free-solid-svg-icons';

import ReviewDropdown from '../ReviewDropdown';
import ReviewModal from '../ReviewModal';
import ReviewStar from '../ReviewStar';
import '../../../../styles/review.css';

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
// import { solid, regular, brands } from '@fortawesome/fontawesome-svg-core/import.macro'; // <-- import styles to be used

export default function ReviewContent({ data, sort }) {
const [alllikeData, setAllLikeData] = useState([]);
// var ID = parseInt(window.sessionStorage.getItem('id'));

const onToggle = (reviewID) => {
if (alllikeData.includes(reviewID)) {
// deleteLike(ID, reviewID);
} else {
// addLike(ID, reviewID);
}
};

const deleteLike = async (userID, reviewID) => {
setAllLikeData(alllikeData.filter((item) => item !== reviewID));

var params = new URLSearchParams();
params.append('user_id', userID);
params.append('review_id', reviewID);
// const response = await axios.post(process.env.REACT_APP_RESTAPI_HOST + 'like/delete', params);
};

const addLike = async (userID, reviewID) => {
setAllLikeData((prevState) => [...prevState, reviewID]);

var params = new URLSearchParams();
params.append('user_id', userID);
params.append('review_id', reviewID);
// const response = await axios.post(process.env.REACT_APP_RESTAPI_HOST + 'like/add', params);
};

return (
<>
{sort === '1'
? data
.sort((a, b) => b.empathyCount - a.empathyCount)
.map((info) => (
<div className="review-content">
{' '}
<div className="review-user-image">
<FontAwesomeIcon icon={faCircleUser} size="5x" color="#BDBDBD" />
</div>
<div className="review-user">
<div className="review-list-icon">
<ReviewModal />
</div>
<div className="review-user-name-star">
<div className="review-user-name">{info.authorName}</div>
<ReviewStar star={info.star} />
</div>

{info.tip ? (
<div className="review-tip-wrapper">
<span className="review-tip-name">나만의 꿀팁</span>
<span className="review-tip-content">{info.tip}</span>
</div>
) : (
''
)}

<div className="review-post">{info.content}</div>
<div className="review-like-button">
<button className="review-button">
{alllikeData.includes(info.id) ? (
<FontAwesomeIcon icon={regularHeart} className="review-like-icon" size="1x" color="#FF6B6C" onClick={onToggle(info.id)} />
) : (
<FontAwesomeIcon icon={solidHeart} className="review-like-icon" size="1x" color="#FF6B6C" onClick={onToggle(info.id)} />
)}
</button>
<span className="review-like-num">{info.empathyCount}</span>
</div>
</div>
</div>
))
: sort === '2'
? data
.sort((a, b) => b.id - a.id)
.map((info) => (
<div className="review-content">
{' '}
<div className="review-user-image">
<FontAwesomeIcon icon={faCircleUser} size="5x" color="#BDBDBD" />
</div>
<div className="review-user">
<div className="review-list-icon">
<ReviewModal />
</div>
<div className="review-user-name-star">
<div className="review-user-name">{info.authorName}</div>
<ReviewStar star={info.star} />
</div>

{info.tip ? (
<div className="review-tip-wrapper">
<span className="review-tip-name">나만의 꿀팁</span>
<span className="review-tip-content">{info.tip}</span>
</div>
) : (
''
)}

<div className="review-post">{info.content}</div>
<div className="review-like-button">
<button className="review-button">
{alllikeData.includes(info.id) ? (
<FontAwesomeIcon icon={regularHeart} className="review-like-icon" size="1x" color="#FF6B6C" onClick={onToggle(info.id)} />
) : (
<FontAwesomeIcon icon={solidHeart} className="review-like-icon" size="1x" color="#FF6B6C" onClick={onToggle(info.id)} />
)}
</button>
<span className="review-like-num">{info.empathyCount}</span>
</div>
</div>
</div>
))
: sort === '3'
? data
.sort((a, b) => b.star - a.star)
.map((info) => (
<div className="review-content">
{' '}
<div className="review-user-image">
<FontAwesomeIcon icon={faCircleUser} size="5x" color="#BDBDBD" />
</div>
<div className="review-user">
<div className="review-list-icon">
<ReviewModal />
</div>
<div className="review-user-name-star">
<div className="review-user-name">{info.authorName}</div>
<ReviewStar star={info.star} />
</div>

{info.tip ? (
<div className="review-tip-wrapper">
<span className="review-tip-name">나만의 꿀팁</span>
<span className="review-tip-content">{info.tip}</span>
</div>
) : (
''
)}

<div className="review-post">{info.content}</div>
<div className="review-like-button">
<button className="review-button">
{alllikeData.includes(info.id) ? (
<FontAwesomeIcon icon={regularHeart} className="review-like-icon" size="1x" color="#FF6B6C" onClick={onToggle(info.id)} />
) : (
<FontAwesomeIcon icon={solidHeart} className="review-like-icon" size="1x" color="#FF6B6C" onClick={onToggle(info.id)} />
)}
</button>
<span className="review-like-num">{info.empathyCount}</span>
</div>
</div>
</div>
))
: data
.sort((a, b) => a.star - b.star)
.map((info) => (
<div className="review-content">
{' '}
<div className="review-user-image">
<FontAwesomeIcon icon={faCircleUser} size="5x" color="#BDBDBD" />
</div>
<div className="review-user">
<div className="review-list-icon">
<ReviewModal />
</div>
<div className="review-user-name-star">
<div className="review-user-name">{info.authorName}</div>
<ReviewStar star={info.star} />
</div>

{info.tip ? (
<div className="review-tip-wrapper">
<span className="review-tip-name">나만의 꿀팁</span>
<span className="review-tip-content">{info.tip}</span>
</div>
) : (
''
)}

<div className="review-post">{info.content}</div>
<div className="review-like-button">
<button className="review-button">
{alllikeData.includes(info.id) ? (
<FontAwesomeIcon icon={regularHeart} className="review-like-icon" size="1x" color="#FF6B6C" onClick={onToggle(info.id)} />
) : (
<FontAwesomeIcon icon={solidHeart} className="review-like-icon" size="1x" color="#FF6B6C" onClick={onToggle(info.id)} />
)}
</button>
<span className="review-like-num">{info.empathyCount}</span>
</div>
</div>
</div>
))}
</>
);
}
Loading

0 comments on commit 0bd7c21

Please sign in to comment.