import React from 'react'; import classNames from 'classnames'; import {scale} from 'proportional-scale'; import { DEFAULT_PRODUCT_ASPECT_WIDTH, DEFAULT_PRODUCT_ASPECT_HEIGHT } from '../responsive_image'; import './aspect_ratio_box.scss'; export interface Props extends React.HTMLAttributes { aspectWidth?: number; aspectHeight?: number; maxWidth: number; maxHeight: number; isOutlined?: boolean; } export const AspectRatioBox: React.FC = ({ aspectWidth = DEFAULT_PRODUCT_ASPECT_WIDTH, aspectHeight = DEFAULT_PRODUCT_ASPECT_HEIGHT, maxWidth, maxHeight, isOutlined = false, children, className, ...rest }) => { const {width, paddingBottom} = scale({ width: aspectWidth, height: aspectHeight, maxWidth, maxHeight }); return (
{children}
); };