Skip to content

Commit

Permalink
if the data is null it does not render the card
Browse files Browse the repository at this point in the history
  • Loading branch information
camilaViquez committed Sep 28, 2023
1 parent fe08c77 commit 79d1646
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions recipes/3d-cuboid-recipe-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ const prettier = (code) => {
const Cuboid3DRecipe = () => {
const cardsData = [
cuboid_3D,
{},
{}
null,
null
]
React.useEffect(() => {
snippets = []
}
), [currentData];
const [currentData] = React.useState({})
const renderCards = cardsData.map((data, index) => <RecipeCard key={index} title={data.title} description={data.description} data={data} modalId={`modal${index}`} />)
const renderCards = cardsData.map((data, index) => !!data ? <RecipeCard key={index} title={data.title} description={data.description} data={data} modalId={`modal${index}`} /> : null)
return (
<div className="container overflow-hidden" >
<div class="row gy-5">
Expand Down
6 changes: 3 additions & 3 deletions recipes/fused-annotation-recipe-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ const prettier = (code) => {

const FusedAnnotationRecipes = () => {
const cardsData = [
{},
{},
null,
null,
fused_annotation
]
React.useEffect(() => {
snippets = []
}
), [currentData];
const [currentData] = React.useState({})
const renderCards = cardsData.map((data, index) => <RecipeCard key={index} title={data.title} description={data.description} data={data} modalId={`modal${index}`} />)
const renderCards = cardsData.map((data, index) => !!data ? <RecipeCard key={index} title={data.title} description={data.description} data={data} modalId={`modal${index}`} /> : null)
return (
<div className="container overflow-hidden" >
<div class="row gy-5">
Expand Down
11 changes: 7 additions & 4 deletions recipes/orthographic-shapes-recipe-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ const prettier = (code) => {

const OrthographicShapesRecipes = () => {
const cardsData = [
{},
null,
orthographic_shapes,
{}
null
]
React.useEffect(() => {
snippets = []
}
), [currentData];
const [currentData] = React.useState({})
const renderCards = cardsData.map((data, index) => <RecipeCard key={index} title={data.title} description={data.description} data={data} modalId={`modal${index}`} />)
const renderCards = cardsData.map((data, index) => !!data ? <RecipeCard key={index} title={data.title} description={data.description} data={data} modalId={`modal${index}`} /> : null)
return (
<div className="container overflow-hidden" >
<div class="row gy-5">
Expand Down Expand Up @@ -256,7 +256,10 @@ const RecipeCard = ({ data, modalId }) => {
<Modal currentData={data} modalId={modalId} />
</div>
</div>
</div>)
</div>
)


}


Expand Down

0 comments on commit 79d1646

Please sign in to comment.