Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update card component with paper prop (#254) #255

Merged
merged 1 commit into from
Jun 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/data-explorer-ui/src/components/common/Card/card.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Card as MCard } from "@mui/material";
import React, { Fragment, ReactNode } from "react";
import { FlatPaper, FluidPaper, RoundedPaper } from "../Paper/paper.styles";
import { StaticImageProps } from "../StaticImage/staticImage";
import { CardContent, CardSection } from "./card.styles";
import {
Expand All @@ -12,12 +14,12 @@ import { CardSecondaryText } from "./components/CardSecondaryText/cardSecondaryT
import { CardSecondaryTitle } from "./components/CardSecondaryTitle/cardSecondaryTitle";
import { CardText } from "./components/CardText/cardText";
import { CardTitle } from "./components/CardTitle/cardTitle";
import { RoundedCard } from "./components/RoundedCard/roundedCard";

export interface CardProps {
cardActions?: CardActionProps[];
cardUrl?: string;
media?: StaticImageProps;
Paper?: typeof FlatPaper | typeof FluidPaper | typeof RoundedPaper;
secondaryText?: ReactNode; // e.g. Date.
secondaryTitle?: ReactNode;
text?: ReactNode;
Expand All @@ -28,6 +30,7 @@ export const Card = ({
cardActions,
cardUrl,
media,
Paper = RoundedPaper,
secondaryText,
secondaryTitle,
text,
Expand All @@ -36,7 +39,7 @@ export const Card = ({
const CardActionArea = cardUrl ? ActionArea : Fragment;
const cardActionAreaProps = cardUrl ? { cardUrl } : {};
return (
<RoundedCard>
<MCard component={Paper}>
<CardActionArea {...cardActionAreaProps}>
<CardSection>
<CardContent>
Expand All @@ -59,6 +62,6 @@ export const Card = ({
)}
</CardSection>
</CardActionArea>
</RoundedCard>
</MCard>
);
};