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

[adv-1단계] 송혜정 미션 제출합니다. #2

Open
wants to merge 2 commits into
base: Songhyejeong
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
143 changes: 138 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
"react-dom": "^18.3.1",
"styled-components": "^6.1.13"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
Expand Down
27 changes: 27 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}

ul,
li {
list-style: none;
}

html,
body {
font-family: sans-serif;
font-size: 16px;
}

/* Colors *****************************************/
:root {
--primary-color: #ec4a0a;
--lighten-color: #f6a88a;
--grey-100: #ffffff;
--grey-200: #d0d5dd;
--grey-300: #667085;
--grey-400: #344054;
--grey-500: #000000;
}
Comment on lines +18 to +27
Copy link
Contributor

@Indigochi1d Indigochi1d Nov 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요구사항 명세에 아래처럼 나와있었어요. 그대로 잘 적용해주셨네요!
image

:root 에서 color styling선언을 통해 전역으로 색 해시값을 문자로 나타내게 할 수 있었는데요. 만약 이것을 styled-components 의 기능 중 하나를 사용해서 전역으로 선언할 수 있다면 어떤 기능을 사용하면 될까요? 🤔

Note

힌트는 저희 스터디 시간에 공유했던 내용중에 있습니다! 답을 찾으신 후 시간이 괜찮으시다면 그걸 토대로 리팩토링해주셔도 되고 다음미션과 현생이슈로 할일이 너무 많다면 이대로 해주셔도 무방해요😆

42 changes: 35 additions & 7 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@

import './App.css'
import './App.css';
import { useState, useEffect } from 'react';
import Main from './components/main/main/Main';
import Aside from './components/aside/Aside';
import { getRestaurant } from './api/restaurant';

function App() {
const [isModalOpen, setIsModalOpen] = useState();
const [isAddModalOpen, setIsAddModalOpen] = useState(false);
const [selectedRestaurant, setSelectedRestaurant] = useState({
name: '',
description: '',
});
const [restaurantsList, setRestaurantsList] = useState([]);

useEffect(() => {
getRestaurant(setRestaurantsList);
}, []);

return (
<>
Code It..
</>
)
<div>
<Main
restaurantsList={restaurantsList}
setIsModalOpen={setIsModalOpen}
setSelectedRestaurant={setSelectedRestaurant}
setIsAddModalOpen={setIsAddModalOpen}
/>
<Aside
isModalOpen={isModalOpen}
isAddModalOpen={isAddModalOpen}
selectedRestaurant={selectedRestaurant}
setIsModalOpen={setIsModalOpen}
setIsAddModalOpen={setIsAddModalOpen}
setRestaurantsList={setRestaurantsList}
/>
</div>
);
}

export default App
export default App;
26 changes: 26 additions & 0 deletions src/api/restaurant.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export const getRestaurant = async (setRestaurantsList) => {
try {
const response = await fetch('http://localhost:3000/restaurants');
const jsonData = await response.json();

if (response.ok) {
setRestaurantsList(jsonData);
} else {
console.error('Failed to fetch restaurants:', response.statusText);
}
} catch (error) {
console.error('Error fetching restaurants:', error);
}
};

export const postRestaurant = async (newRestaurant) => {
const response = await fetch('http://localhost:3000/restaurants', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(newRestaurant),
});

return response;
};
Empty file added src/assets/.gitkeep
Empty file.
Binary file added src/assets/button/add-button.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 src/assets/category/category-asian.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 src/assets/category/category-chinese.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 src/assets/category/category-etc.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 src/assets/category/category-japanese.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 src/assets/category/category-korean.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 src/assets/category/category-western.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading