-
Notifications
You must be signed in to change notification settings - Fork 4
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
4 changed files
with
52 additions
and
80 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 |
---|---|---|
@@ -1,21 +1,46 @@ | ||
// ShowcaseCards.tsx | ||
import React, { useState, useEffect } from 'react'; | ||
import ShowcaseCard,{ ShowcaseItem } from './ShowcaseCard'; | ||
|
||
import React from 'react'; | ||
import ShowcaseCard from './ShowcaseCard'; | ||
import { showcaseItems } from './ShowcaseItems'; | ||
|
||
const ShowcaseCards: React.FC = () => { | ||
return ( | ||
<div className="container"> | ||
<div className="row"> | ||
{showcaseItems.map((item, index) => ( | ||
<div key={index} className="col col--4"> | ||
<ShowcaseCard item={item} /> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
const [items, setItems] = useState<ShowcaseItem[]>([]); | ||
const [isLoading, setLoading] = useState(true); | ||
|
||
// Fetch the JSON data when the component mounts | ||
useEffect(() => { | ||
fetch('/community/showcase/showcaseList.json') // Adjust the path as necessary | ||
.then(response => { | ||
if (!response.ok) { | ||
throw new Error('Network response was not ok'); | ||
} | ||
return response.json(); | ||
}) | ||
.then(data => { | ||
setItems(data); | ||
setLoading(false); | ||
}) | ||
.catch(error => { | ||
console.error('Error loading the showcase items:', error); | ||
setLoading(false); | ||
}); | ||
}, []); | ||
|
||
// Optionally handle loading state | ||
if (isLoading) { | ||
return <div>Loading...</div>; | ||
} | ||
|
||
return ( | ||
<div className="container"> | ||
<div className="row"> | ||
{items.map((item, index) => ( | ||
<div key={index} className="col col--4"> | ||
<ShowcaseCard item={item} /> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ShowcaseCards; |
This file was deleted.
Oops, something went wrong.