2025-01-15 19:41:46 +01:00
|
|
|
/**
|
2025-01-27 13:45:52 +01:00
|
|
|
* Temporary component, until the experimental VStack/HStack block editor component is stable.
|
2025-01-15 19:41:46 +01:00
|
|
|
*
|
|
|
|
* @see https://wordpress.github.io/gutenberg/?path=/docs/components-experimental-hstack--docs
|
2025-01-27 13:50:28 +01:00
|
|
|
* @see https://wordpress.github.io/gutenberg/?path=/docs/components-experimental-vstack--docs
|
2025-01-15 19:41:46 +01:00
|
|
|
* @file
|
|
|
|
*/
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
2025-01-27 13:50:28 +01:00
|
|
|
const Stack = ( { type, className, spacing, children } ) => {
|
2025-01-15 19:41:46 +01:00
|
|
|
const wrapperClass = classNames(
|
2025-01-27 13:50:28 +01:00
|
|
|
'components-flex',
|
|
|
|
`components-${ type }-stack`,
|
2025-01-15 19:41:46 +01:00
|
|
|
className
|
|
|
|
);
|
|
|
|
|
|
|
|
const styles = {
|
|
|
|
gap: `calc(${ 4 * spacing }px)`,
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={ wrapperClass } style={ styles }>
|
|
|
|
{ children }
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
2025-01-27 13:50:28 +01:00
|
|
|
|
|
|
|
export const HStack = ( { className, spacing = 3, children } ) => {
|
|
|
|
return (
|
|
|
|
<Stack type="h" className={ className } spacing={ spacing }>
|
|
|
|
{ children }
|
|
|
|
</Stack>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const VStack = ( { className, spacing = 3, children } ) => {
|
|
|
|
return (
|
|
|
|
<Stack type="v" className={ className } spacing={ spacing }>
|
|
|
|
{ children }
|
|
|
|
</Stack>
|
|
|
|
);
|
|
|
|
};
|