-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#77): add cards tree details page ui
- Loading branch information
Showing
8 changed files
with
131 additions
and
203 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
100 changes: 0 additions & 100 deletions
100
dashboard/src/components/Cards/ListingComponentCard/ListingComponentsCars.stories.tsx
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
dashboard/src/components/GroupCards/GroupListingComponentCard.tsx
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,48 @@ | ||
import { useMemo } from 'react'; | ||
|
||
import ListingComponentContent, { | ||
IListingComponent, | ||
} from '../Cards/ListingComponentCard/ListingComponentCard'; | ||
import Summary, { ISummary } from '../Summary/Summary'; | ||
import BaseCard from '../Cards/BaseCard'; | ||
|
||
interface IListingComponentCardsGroup { | ||
cards: (IListingComponent | ISummary)[]; | ||
} | ||
|
||
interface ICardContent { | ||
card: IListingComponent | ISummary; | ||
} | ||
|
||
const ListingComponentCardsGroup = ({ | ||
cards, | ||
}: IListingComponentCardsGroup): JSX.Element => { | ||
const cardsList = useMemo(() => { | ||
return cards.map(card => ( | ||
<BaseCard | ||
key={card.title} | ||
title={card.title} | ||
content={<CardContent card={card} />} | ||
/> | ||
)); | ||
}, [cards]); | ||
return <div className="grid grid-cols-2 gap-8">{cardsList}</div>; | ||
}; | ||
|
||
const CardContent = ({ card }: ICardContent): JSX.Element => { | ||
if (card.type === 'listing' && card.items) { | ||
return <ListingComponentContent key={card.title} items={card.items} />; | ||
} else if (card.type === 'summary' && card.summaryBody) { | ||
return ( | ||
<Summary | ||
key="" | ||
summaryHeaders={card?.summaryHeaders} | ||
summaryBody={card?.summaryBody} | ||
/> | ||
); | ||
} else { | ||
return <></>; | ||
} | ||
}; | ||
|
||
export default ListingComponentCardsGroup; |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.