Skip to content

Commit

Permalink
Fix border width and border radius issue
Browse files Browse the repository at this point in the history
  • Loading branch information
girishpanchal30 committed Sep 24, 2024
1 parent 116a035 commit b8a9cab
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
7 changes: 7 additions & 0 deletions inc/css/class-css-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,13 @@ public function generate() {
* @return string
*/
public static function box_values( $box, $box_default = array() ) {
$box = array_map(
function ( $value ) {
return is_numeric( $value ) ? $value . 'px' : $value;
},
$box
);

return self::render_box(
array_merge(
array(
Expand Down
28 changes: 28 additions & 0 deletions src/blocks/blocks/button-group/button/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,34 @@ const Save = ({
}) => {
const Icon = themeIsleIcons.icons[ attributes.icon ];

// Border radius
if ( ! isNaN( attributes?.borderRadius?.top ) ) {
attributes.borderRadius.top += 'px';
}
if ( ! isNaN( attributes?.borderRadius?.right ) ) {
attributes.borderRadius.right += 'px';
}
if ( ! isNaN( attributes?.borderRadius?.left ) ) {
attributes.borderRadius.left += 'px';
}
if ( ! isNaN( attributes?.borderRadius?.bottom ) ) {
attributes.borderRadius.bottom += 'px';
}

// border size
if ( ! isNaN( attributes?.borderSize?.top ) ) {
attributes.borderSize.top += 'px';
}
if ( ! isNaN( attributes?.borderSize?.right ) ) {
attributes.borderSize.right += 'px';
}
if ( ! isNaN( attributes?.borderSize?.left ) ) {
attributes.borderSize.left += 'px';
}
if ( ! isNaN( attributes?.borderSize?.bottom ) ) {
attributes.borderSize.bottom += 'px';
}

const blockProps = useBlockProps.save({
id: attributes.id,
className: 'wp-block-button'
Expand Down

0 comments on commit b8a9cab

Please sign in to comment.