0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 21:53:27 -05:00
penpot-exporter-figma-plugin/ui-src/components/Wrapper/Wrapper.tsx
Alex Sánchez 8d5c5c15eb
Dynamic plugin size calculation, and cap the height to a safe value (#98)
* dynamic size

* fixes

* fixes

* fix dynamic size

* add changelog

---------

Co-authored-by: Jordi Sala Morales <jordism91@gmail.com>
2024-05-13 10:08:26 +02:00

27 lines
646 B
TypeScript

import classNames from 'classnames';
import { CSSProperties, PropsWithChildren, forwardRef } from 'react';
import styles from './Wrapper.module.css';
type WrapperProps = PropsWithChildren & {
style?: CSSProperties;
overflowing?: boolean;
};
const Wrapper = forwardRef<HTMLDivElement, WrapperProps>(
({ style, overflowing = false, children }: WrapperProps, ref) => {
return (
<div
ref={ref}
className={classNames({ [styles.wrapper]: true, [styles.wrapperOverflow]: overflowing })}
style={style}
>
{children}
</div>
);
}
);
Wrapper.displayName = 'Wrapper';
export { Wrapper };