-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
141 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,4 +51,4 @@ export default function Feed(){ | |
</div> | ||
{/* </RecoilRoot> */} | ||
</>) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,40 @@ | ||
import axios from "axios"; | ||
import { useEffect, useState } from "react"; | ||
import "@/style/bestItem.scss"; | ||
|
||
//현재 최저, 최고온도에 따른 가장 많이쓰인 카테고리 탑5 | ||
async function getTop5() { | ||
try { | ||
const result = await axios({ | ||
method: "GET", | ||
url: "https://www.jerneithe.site/category/tops?temp_min=8&temp_max=10", | ||
}); | ||
|
||
console.log(result.data); | ||
} catch (err) { | ||
console.log(err); | ||
} | ||
interface Category { | ||
_id: string; | ||
count: number; | ||
} | ||
|
||
export default function BestItem() { | ||
const [categories, setCategories] = useState<Category[]>([]); | ||
//현재 최저, 최고온도에 따른 가장 많이쓰인 카테고리 탑5 | ||
useEffect(() => { | ||
async function getTop5() { | ||
try { | ||
const response = await axios({ | ||
method: "GET", | ||
url: "https://www.jerneithe.site/category/tops?temp_min=0&temp_max=30", | ||
}); | ||
|
||
setCategories(response.data.result); | ||
console.log(response.data.result); | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
|
||
getTop5(); | ||
}, []); | ||
|
||
return ( | ||
<div className="categoryTop5"> | ||
{categories.map((category, index) => ( | ||
<button className="category_btn" key={index}> | ||
{category._id} | ||
</button> | ||
))} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@import "_util.scss"; | ||
|
||
.categoryTop5 { | ||
width: 100%; | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.category_btn { | ||
border-radius: 20px; | ||
padding: 2px 7px; | ||
font-size: 13px; | ||
font-weight: 500; | ||
margin-top: 5px; | ||
margin-right: 5px; | ||
border: 1px solid $color-main; | ||
color: $color-main; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,11 @@ header { | |
} | ||
} | ||
} | ||
|
||
.main { | ||
width: 95%; | ||
height: auto; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} |