blob: 703d5d6eb8c8f5368479dc320d05e481045364cb (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
import NextImage, { type ImageProps } from 'next/image';
import {
type ForwardedRef,
forwardRef,
type ForwardRefRenderFunction,
} from 'react';
import { Logo, type LogoProps } from '../../atoms';
import styles from './flipping-logo.module.scss';
export type FlippingLogoProps = {
/**
* Set additional classnames to the logo wrapper.
*/
className?: string;
/**
* Photo alternative text.
*/
altText: string;
/**
* Logo image title.
*/
logoTitle?: LogoProps['heading'];
/**
* Photo url.
*/
photo: ImageProps['src'];
};
const FlippingLogoWithRef: ForwardRefRenderFunction<
HTMLDivElement,
FlippingLogoProps
> = (
{ className = '', altText, logoTitle, photo, ...props },
ref: ForwardedRef<HTMLDivElement>
) => {
const wrapperClass = `${styles.logo} ${className}`;
const size = 100;
return (
<div className={wrapperClass} ref={ref}>
<div className={styles.logo__front}>
<NextImage
{...props}
alt={altText}
height={size}
src={photo}
style={{ objectFit: 'cover' }}
width={size}
/>
</div>
<div className={styles.logo__back}>
<Logo heading={logoTitle} />
</div>
</div>
);
};
/**
* FlippingLogo component
*
* Render a logo and a photo with a flipping effect.
*/
export const FlippingLogo = forwardRef(FlippingLogoWithRef);
|