Skip to content

Commit

Permalink
Fix button style wrapper and props passed (#23)
Browse files Browse the repository at this point in the history
* Fix button style wrapper and props passed

* Changelog
  • Loading branch information
sneridagh authored Oct 18, 2024
1 parent 00f7b61 commit a8716c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/volto-button-block/news/23.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix style wrapper in view and props passed to the legacy wrapper @sneridagh
9 changes: 5 additions & 4 deletions packages/volto-button-block/src/components/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ const messages = defineMessages({
});

const LegacyWrapper = (props) => (
<div className={cx('block __button', props.className)}>
<div className={cx('block __button', props.className)} style={props.style}>
<div className="button container">
<div className={cx(`align ${props.data?.inneralign}`)}>
<div className={cx('align', props.data?.inneralign)}>
{props.children}
</div>
</div>
</div>
);

const View = ({ data, isEditMode, className, blocksConfig }) => {
const View = (props) => {
const { data, isEditMode, blocksConfig } = props;
const [hasLink, setHasLink] = React.useState(false);
const intl = useIntl();
const isBlockModelv3 = blocksConfig?.__button?.blockModel === 3;
Expand Down Expand Up @@ -58,7 +59,7 @@ const View = ({ data, isEditMode, className, blocksConfig }) => {
);

return (
<MaybeWrap condition={!isBlockModelv3} as={LegacyWrapper}>
<MaybeWrap {...props} condition={!isBlockModelv3} as={LegacyWrapper}>
{link}
</MaybeWrap>
);
Expand Down

0 comments on commit a8716c7

Please sign in to comment.