blob: 31c23f5349601277518467f629a7fe73a39777de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import {
type ForwardRefRenderFunction,
type HTMLAttributes,
forwardRef,
type ReactNode,
} from 'react';
import styles from './flip.module.scss';
export type FlipSideProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
/**
* The side contents.
*/
children: ReactNode;
/**
* Is it the back side of the flip component?
*
* @default false
*/
isBack?: boolean;
};
const FlipSideWithRef: ForwardRefRenderFunction<
HTMLDivElement,
FlipSideProps
> = ({ children, className = '', isBack = false, ...props }, ref) => {
const sideClass = [isBack ? styles.back : styles.front, className].join(' ');
return (
<div {...props} className={sideClass} ref={ref}>
{children}
</div>
);
};
export const FlipSide = forwardRef(FlipSideWithRef);
|