Skip to content

Commit

Permalink
Fixed border width and border radius issue (#2377)
Browse files Browse the repository at this point in the history
* Fix border width and border radius issue

---------

Co-authored-by: Hardeep Asrani <[email protected]>
  • Loading branch information
girishpanchal30 and HardeepAsrani authored Oct 3, 2024
1 parent cae7c91 commit e825625
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 e825625

Please sign in to comment.