aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/card/card-footer.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/molecules/card/card-footer.tsx')
-rw-r--r--src/components/molecules/card/card-footer.tsx32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/components/molecules/card/card-footer.tsx b/src/components/molecules/card/card-footer.tsx
new file mode 100644
index 0000000..56a6513
--- /dev/null
+++ b/src/components/molecules/card/card-footer.tsx
@@ -0,0 +1,32 @@
+import {
+ forwardRef,
+ type ForwardRefRenderFunction,
+ type ReactNode,
+} from 'react';
+import { Footer, type FooterProps } from '../../atoms';
+import { useCardFooterMeta } from './card-provider';
+import styles from './card.module.scss';
+
+export type CardFooterProps = Omit<FooterProps, 'children'> & {
+ /**
+ * The card footer contents.
+ */
+ children?: ReactNode;
+};
+
+const CardFooterWithRef: ForwardRefRenderFunction<
+ HTMLElement,
+ CardFooterProps
+> = ({ children, className = '', ...props }, ref) => {
+ const footerClass = `${styles.footer} ${className}`;
+ const meta = useCardFooterMeta();
+
+ return (
+ <Footer {...props} className={footerClass} ref={ref}>
+ {children}
+ {meta}
+ </Footer>
+ );
+};
+
+export const CardFooter = forwardRef(CardFooterWithRef);