Skip to content

Commit

Permalink
Fix alignment bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
ndiego committed Oct 1, 2022
1 parent 149b403 commit e5a79a2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
20 changes: 13 additions & 7 deletions src/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ export function Edit( props ) {
const {
flipHorizontal,
flipVertical,
label,
title,
linkRel,
linkTarget,
linkUrl,
hasNoIconFill,
icon,
iconBackgroundColorValue,
iconColorValue,
hasNoIconFill,
iconName,
itemsJustification,
label,
linkRel,
linkTarget,
linkUrl,
percentWidth,
rotate,
title,
width,
} = attributes;
const { gradientClass, gradientValue, setGradient } = useGradient();
Expand Down Expand Up @@ -558,7 +558,13 @@ export function Edit( props ) {
{ blockControls }
{ inspectorControls }
<div
{ ...useBlockProps( { ref, onKeyDown } ) }
{ ...useBlockProps( {
className:
itemsJustification &&
`items-justified-${ itemsJustification }`,
ref,
onKeyDown,
} ) }
// This is a bit of a hack. we only want the margin styles
// applied to the main block div.
style={ blockMargin }
Expand Down
25 changes: 15 additions & 10 deletions src/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,25 @@ import parseIcon from './utils/parse-icon';
*/
export default function Save( props ) {
const {
customGradient,
flipHorizontal,
flipVertical,
gradient,
hasNoIconFill,
icon,
iconName,
iconBackgroundColor,
iconBackgroundColorValue,
iconColorValue,
hasNoIconFill,
gradient,
customGradient,
iconName,
itemsJustification,
label,
title,
linkUrl,
linkRel,
linkTarget,
linkUrl,
percentWidth,
rotate,
flipHorizontal,
flipVertical,
title,
width,
percentWidth,
} = props.attributes;

// If there is no icon and no iconName, don't save anything.
Expand Down Expand Up @@ -166,7 +167,11 @@ export default function Save( props ) {

return (
<div
{ ...useBlockProps.save() }
{ ...useBlockProps.save( {
className:
itemsJustification &&
`items-justified-${ itemsJustification }`,
} ) }
// This is a bit of a hack. we only want the margin styles
// applied to the main block div.
style={ blockMargin }
Expand Down

0 comments on commit e5a79a2

Please sign in to comment.