Skip to content

Commit

Permalink
Merge pull request #14 from svipulc/fix/card-component
Browse files Browse the repository at this point in the history
  • Loading branch information
svipulc authored Sep 4, 2024
2 parents 70a6d94 + 3831f8d commit 2b7b8af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/components/Card/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { Meta, StoryObj } from "@storybook/react";
import React from "react";
import { IoMdHeartEmpty } from "react-icons/io";
import { IoChatbubbleEllipsesOutline, IoChatbubbleEllipsesSharp, IoHeart } from "react-icons/io5";
import Card from ".";
import { Card } from ".";
import { Button } from "../Button";

const meta: Meta<typeof Card> = {
Expand Down
13 changes: 5 additions & 8 deletions src/components/Card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import React, { ComponentProps } from "react";
import { cardContentStyle, cardFooterStyle, cardHeaderStyle, cardStyle } from "./index.style";

// Card Component
type CardProps = ComponentProps<"div"> & VariantProps<typeof cardStyle>;
export type CardProps = ComponentProps<"div"> & VariantProps<typeof cardStyle>;

const Card: React.FC<CardProps> & {
export const Card: React.FC<CardProps> & {
Header: React.FC<CardHeaderProps>;
Content: React.FC<CardContentProps>;
Footer: React.FC<CardFooterProps>;
Expand All @@ -19,7 +19,7 @@ const Card: React.FC<CardProps> & {
};

// Card Header Component
type CardHeaderProps = ComponentProps<"div"> & VariantProps<typeof cardHeaderStyle>;
export type CardHeaderProps = ComponentProps<"div"> & VariantProps<typeof cardHeaderStyle>;

const CardHeader: React.FC<CardHeaderProps> = ({ children, className, ...props }) => {
return (
Expand All @@ -30,7 +30,7 @@ const CardHeader: React.FC<CardHeaderProps> = ({ children, className, ...props }
};

// Card Content Component
type CardContentProps = ComponentProps<"div"> & VariantProps<typeof cardContentStyle>;
export type CardContentProps = ComponentProps<"div"> & VariantProps<typeof cardContentStyle>;

const CardContent: React.FC<CardContentProps> = ({ children, className, ...props }) => {
return (
Expand All @@ -41,7 +41,7 @@ const CardContent: React.FC<CardContentProps> = ({ children, className, ...props
};

// Card Footer Component
type CardFooterProps = ComponentProps<"div"> & VariantProps<typeof cardFooterStyle>;
export type CardFooterProps = ComponentProps<"div"> & VariantProps<typeof cardFooterStyle>;

const CardFooter: React.FC<CardFooterProps> = ({ children, className, ...props }) => {
return (
Expand All @@ -55,6 +55,3 @@ const CardFooter: React.FC<CardFooterProps> = ({ children, className, ...props }
Card.Header = CardHeader;
Card.Content = CardContent;
Card.Footer = CardFooter;

// Export the Card component
export default Card;

0 comments on commit 2b7b8af

Please sign in to comment.