Skip to content

Commit

Permalink
fix(heading): heading v3 with less aggresive non use of theme margins
Browse files Browse the repository at this point in the history
  • Loading branch information
Arukuen committed Oct 9, 2024
1 parent d4f76c7 commit 4d0f8c2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
15 changes: 15 additions & 0 deletions src/block/heading/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ import {
*/
import { addFilter } from '@wordpress/hooks'

// Version 3.13.9 Deprecations
addFilter( 'stackable.heading.save.blockClassNames', 'stackable/3.13.9', ( output, props ) => {
if ( compareVersions( props.version, '3.13.9' ) >= 0 ) { // Current version is greater than or equal to 3.13.9
return output
}

const responsiveClass = getResponsiveClasses( props.attributes )
return [
props.className,
'stk-block-heading',
responsiveClass,
'stk-block-heading--v2',
]
} )

// Version 3.6.1 Deprecations
addFilter( 'stackable.heading.save.blockClassNames', 'stackable/3.6.1', ( output, props ) => {
if ( compareVersions( props.version, '3.6.1' ) === 1 ) { // Current version is greater than 3.6.1
Expand Down
2 changes: 1 addition & 1 deletion src/block/heading/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const Edit = props => {
const blockClassNames = classnames( [
className,
'stk-block-heading',
'stk-block-heading--v2',
'stk-block-heading--v3',
] )

const textClassNames = classnames( [
Expand Down
2 changes: 1 addition & 1 deletion src/block/heading/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const Save = props => {
className,
'stk-block-heading',
responsiveClass,
'stk-block-heading--v2',
'stk-block-heading--v3',
], props ) )

const textClassNames = classnames( [
Expand Down
7 changes: 7 additions & 0 deletions src/block/heading/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@
margin: 0 !important;
}
}

.stk-block-heading--v3 {
.stk-block-heading__text:not(.stk-block-heading--use-theme-margins) {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
}

0 comments on commit 4d0f8c2

Please sign in to comment.