aspectDiv.tsx

 1import * as React from 'react';
 2
 3export interface AspectDivProps {
 4    aspectRatio: string;
 5}
 6
 7export const AspectDiv = (props: React.PropsWithChildren<AspectDivProps>) => {
 8    return (
 9        <div
10            style={{
11                position: 'relative',
12                width: '100%',
13                height: 0,
14                paddingBottom: props.aspectRatio,
15            }}
16        >
17            {props.children}
18        </div>
19    );
20};