Skip to content

Commit 20849ce

Browse files
committed
add sort by popularity when fetching the fonts
1 parent bc28470 commit 20849ce

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/Components/Main-container/Main-container.jsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const MainContainer = () => {
2020
const fetchData = async () => {
2121
try {
2222
let getGoogleFonts = await fetch(
23-
"https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyAjfp0YTzzzGDEWaGuXoN4imwRA4bTSwrM"
23+
"https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyAjfp0YTzzzGDEWaGuXoN4imwRA4bTSwrM&sort=popularity"
2424
);
2525
let googleFonts = await getGoogleFonts.json();
2626
console.log(googleFonts);
@@ -35,14 +35,13 @@ const MainContainer = () => {
3535
return (
3636
<main className="main-container">
3737
<Toolbar />
38-
<p>
39-
{data.items.map(f => (
40-
<div>
41-
<p>{f.family}</p>
42-
<p>{f.category}</p>
43-
</div>
44-
))}
45-
</p>
38+
39+
{data.items.map(f => (
40+
<div>
41+
<p>{f.family}</p>
42+
<p>{f.category}</p>
43+
</div>
44+
))}
4645
</main>
4746
);
4847
};

0 commit comments

Comments
 (0)