1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-05-01 15:46:40 +07:00
vault-frontend/src/components/common/Square/index.tsx
2022-01-09 21:24:20 +07:00

26 lines
694 B
TypeScript

import React, { forwardRef, ForwardRefRenderFunction, VFC } from 'react';
import styles from './styles.module.scss';
import { DivProps } from '~/utils/types';
import classNames from 'classnames';
interface SquareProps extends DivProps {
image: string;
size?: number;
}
const Square = forwardRef<HTMLDivElement, SquareProps>(({ image, size, ...rest }, ref) => {
const backgroundImage = image ? `url('${image}')` : undefined;
return (
<div
{...rest}
className={classNames(styles.wrapper, rest.className)}
style={{ backgroundImage, width: size }}
ref={ref}
>
<svg className={styles.svg} viewBox="0 0 1 1" />
</div>
);
});
export { Square };