조국현

Update main.css, main.html, main.js, index.js and Delete index.css

...@@ -156,6 +156,53 @@ const getLoginButton = (auth) =>{ ...@@ -156,6 +156,53 @@ const getLoginButton = (auth) =>{
156 <!DOCTYPE html> 156 <!DOCTYPE html>
157 <html> 157 <html>
158 <head> 158 <head>
159 + <style>
160 + body {
161 + padding-top: 15px;
162 + font-size: 12px
163 + }
164 + .main {
165 + max-width: 320px;
166 + margin-top:300px auto;
167 + margin: 0 auto;
168 + }
169 + .login-or {
170 + position: relative;
171 + font-size: 18px;
172 + color: rgb(7, 7, 7);
173 + margin-top: 10px;
174 + margin-bottom: 10px;
175 + padding-top: 10px;
176 + padding-bottom: 10px;
177 + }
178 + .span-or {
179 + display: block;
180 + position: absolute;
181 + left: 50%;
182 + top: -2px;
183 + margin-left: -25px;
184 + background-color: #fff;
185 + width: 50px;
186 + text-align: center;
187 + }
188 + .hr-or {
189 + background-color: #cdcdcd;
190 + height: 1px;
191 + margin-top: 0px !important;
192 + margin-bottom: 0px !important;
193 + }
194 + h3 {
195 + text-align: center;
196 + line-height: 300%;
197 + margin-top:10px auto;
198 + }
199 + img{
200 + width:300px;
201 + height:150px;
202 + object-fit:cover;
203 + margin-bottom:30px;
204 + }
205 + </style>
159 <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> 206 <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
160 <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> 207 <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
161 <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> 208 <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
...@@ -166,10 +213,14 @@ const getLoginButton = (auth) =>{ ...@@ -166,10 +213,14 @@ const getLoginButton = (auth) =>{
166 <div class="container"> 213 <div class="container">
167 <div class="row"> 214 <div class="row">
168 <div class="main"> 215 <div class="main">
216 + <img src="https://i.ibb.co/k2zSVcn/142437038-e7b564cb-978a-4018-8834-9984cc3b119e.png" alt=""/>
217 + <!--이미지 아래부분이 살짝 잘림 -->
218 + <!--로그인,회원가입버튼 오른쪽 맞추는게 더 깔끔할거같음 -->
219 +
169 <h3>Login</h3> 220 <h3>Login</h3>
170 <form role="form" method="POST" action="/login"> 221 <form role="form" method="POST" action="/login">
171 <div class="form-group"> 222 <div class="form-group">
172 - <label for="userId">ID</label> 223 + <label for="userId">아이디</label>
173 <input type="text" class="form-control" id="email" name="email"> 224 <input type="text" class="form-control" id="email" name="email">
174 </div> 225 </div>
175 <div class="form-group"> 226 <div class="form-group">
...@@ -177,18 +228,17 @@ const getLoginButton = (auth) =>{ ...@@ -177,18 +228,17 @@ const getLoginButton = (auth) =>{
177 <input type="password" class="form-control" id="password" name="password"> 228 <input type="password" class="form-control" id="password" name="password">
178 </div> 229 </div>
179 <button type="submit" class="btn btn btn-primary"> 230 <button type="submit" class="btn btn btn-primary">
180 - Enter 231 + 로그인
181 </button> 232 </button>
233 + <button type="submit" class="btn btn btn-primary">
234 + <a href="/join" style="color:white;text-decoration-line:none;"> 회원가입</a>
182 </form> 235 </form>
183 - <div> 236 +
184 - <a href="/join" style="background : #E5E5E5;padding : 2px; border: 0.5px solid black;cursor:pointer;border-radius:3px;font-size:13px;color:black;text-decoration:none;">회원가입</a>
185 - </div>
186 </div> 237 </div>
187 </div> 238 </div>
188 </div> 239 </div>
189 </body> 240 </body>
190 </html> 241 </html>
191 -
192 `; 242 `;
193 } 243 }
194 244
......
1 +*{
2 + padding:0;
3 + margin:0;
4 + box-sizing:border-box;
5 +}
6 +.containter{
7 + width:90%;
8 + height:auto;
9 + max-width:1200px;
10 + margin:0 auto;
11 +}
12 +form{
13 + width:50%;
14 + max-width:400px;
15 + border-radius:4px;
16 +}
17 +form input{
18 + width:100%;
19 +}
20 +form ion-icon{
21 + width:9%;
22 + font-size:3rem;
23 + margin:-15px;
24 + color:rgb(75,75,75);
25 +
26 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -5,14 +5,18 @@ ...@@ -5,14 +5,18 @@
5 <meta charset="UTF-8"> 5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <title>Document</title> 7 <title>Document</title>
8 + <link rel="style sheet" href="main.css">
8 </head> 9 </head>
9 <body> 10 <body>
10 <section> 11 <section>
11 <div class="container"> 12 <div class="container">
12 <h1 class="brand">Recipe APP</h1> 13 <h1 class="brand">Recipe APP</h1>
14 + <div class="serach-box">
13 <form> 15 <form>
14 <input id="name" type="text" placeholder="Search Your Recipe..."> 16 <input id="name" type="text" placeholder="Search Your Recipe...">
17 + <ion-icon name="search"></ion-icon>
15 </form> 18 </form>
19 + </div>
16 <div class="search-result"> 20 <div class="search-result">
17 <!--<div class="item"> 21 <!--<div class="item">
18 <img src="./0.jpg" alt=""> 22 <img src="./0.jpg" alt="">
...@@ -26,5 +30,7 @@ ...@@ -26,5 +30,7 @@
26 </div> 30 </div>
27 </section> 31 </section>
28 <script src="./main.js"></script> 32 <script src="./main.js"></script>
33 + <script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
34 + <script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
29 </body> 35 </body>
30 </html> 36 </html>
......
1 const searchForm = document.querySelector('form'); 1 const searchForm = document.querySelector('form');
2 const searchResultDiv = document.querySelector('.search-result') 2 const searchResultDiv = document.querySelector('.search-result')
3 -
4 const APP_ID = '0a67fbc1'; 3 const APP_ID = '0a67fbc1';
5 const APP_KEY = '225d31b59bf211d7ede34e2e885f1f3b'; 4 const APP_KEY = '225d31b59bf211d7ede34e2e885f1f3b';
6 -
7 searchForm.addEventListener('submit', function(event){ 5 searchForm.addEventListener('submit', function(event){
8 if(document.getElementById('name').value.length === 0){ 6 if(document.getElementById('name').value.length === 0){
9 alert('한글자 이상 입력해주세요'); 7 alert('한글자 이상 입력해주세요');
...@@ -15,7 +13,6 @@ searchForm.addEventListener('submit', function(event){ ...@@ -15,7 +13,6 @@ searchForm.addEventListener('submit', function(event){
15 fetchAPI(); 13 fetchAPI();
16 } 14 }
17 }); 15 });
18 -
19 async function fetchAPI(){ 16 async function fetchAPI(){
20 const recipeURL = `https://api.edamam.com/search?q=${searchQuery}&app_id=${APP_ID}&app_key=${APP_KEY}`; 17 const recipeURL = `https://api.edamam.com/search?q=${searchQuery}&app_id=${APP_ID}&app_key=${APP_KEY}`;
21 const response = await fetch(recipeURL); 18 const response = await fetch(recipeURL);
...@@ -23,12 +20,28 @@ async function fetchAPI(){ ...@@ -23,12 +20,28 @@ async function fetchAPI(){
23 boxinfo(data.hits); 20 boxinfo(data.hits);
24 console.log(data); 21 console.log(data);
25 } 22 }
26 -
27 function boxinfo(results){ 23 function boxinfo(results){
28 let boxsinfo =''; 24 let boxsinfo ='';
29 results.map(result => { 25 results.map(result => {
30 boxsinfo += 26 boxsinfo +=
31 ` 27 `
28 + <style>
29 + .item{
30 + display:flex;
31 + flex-wrap:wrap;
32 + margin-left:50px auto;
33 + }
34 + .container{
35 + display:flex;
36 + flex-wrap:wrap;
37 + margin-left:50px auto;
38 +
39 + }
40 + <!--검색결과사진,레시피정보 모두 검색창 옆으로 가게하는거까지는 되었고 2열씩 정렬하려 했는데 2열 정렬 부분이 미완성. 우선 사진 옆으로 정보만 수평으로 뜸-->
41 + <!--검색결과 뜰 시에 검색창 위치가 바뀌는 문제 있음-->
42 +
43 +
44 + </style>
32 <div class="item"> 45 <div class="item">
33 <img src="${result.recipe.image}" alt=""> 46 <img src="${result.recipe.image}" alt="">
34 <div class="flex-container"> 47 <div class="flex-container">
......
1 -body {
2 - padding-top: 15px;
3 - font-size: 12px
4 -}
5 -.main {
6 - max-width: 320px;
7 - margin: 0 auto;
8 -}
9 -.login-or {
10 - position: relative;
11 - font-size: 18px;
12 - color: #aaa;
13 - margin-top: 10px;
14 - margin-bottom: 10px;
15 - padding-top: 10px;
16 - padding-bottom: 10px;
17 -}
18 -.span-or {
19 - display: block;
20 - position: absolute;
21 - left: 50%;
22 - top: -2px;
23 - margin-left: -25px;
24 - background-color: #fff;
25 - width: 50px;
26 - text-align: center;
27 -}
28 -.hr-or {
29 - background-color: #cdcdcd;
30 - height: 1px;
31 - margin-top: 0px !important;
32 - margin-bottom: 0px !important;
33 -}
34 -h3 {
35 - text-align: center;
36 - line-height: 300%;
37 -}
...\ No newline at end of file ...\ No newline at end of file