Skip to content

Commit

Permalink
refactor(member): add description to section component (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
gwansikk committed Apr 3, 2024
1 parent 395688a commit 23e69ba
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions apps/member/src/components/common/Section/Section.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import classNames from 'classnames';
import { type PropsWithChildren } from 'react';

interface SectionProps {
children: React.ReactNode;
interface SectionProps extends PropsWithChildren {
className?: string;
}

interface SectionHeaderProps extends PropsWithChildren {
title: string;
description?: string;
}

interface SectionBodyProps extends PropsWithChildren {
className?: string;
}

Expand All @@ -18,25 +27,18 @@ const Section = ({ className, children }: SectionProps) => {
);
};

interface SectionHeaderProps {
title: string;
children?: React.ReactNode;
}

Section.Header = ({ title, children }: SectionHeaderProps) => {
Section.Header = ({ children, title, description }: SectionHeaderProps) => {
return (
<div className="flex items-center justify-between">
<p className="text-xl font-bold leading-loose text-black">{title}</p>
<div>{children}</div>
<div className="flex items-center">
<p className="text-sm font-semibold text-gray-500">{description}</p>
{children}
</div>
</div>
);
};

interface SectionBodyProps {
className?: string;
children: React.ReactNode;
}

Section.Body = ({ className, children }: SectionBodyProps) => {
return <div className={classNames('mt-4', className)}>{children}</div>;
};
Expand Down

0 comments on commit 23e69ba

Please sign in to comment.