@@ -12,7 +12,7 @@ import {
1212 AdvancedSelectControl ,
1313} from '~stackable/components'
1414import { i18n } from 'stackable'
15- import { useBlockAttributesContext } from '~stackable/hooks'
15+ import { useBlockAttributesContext , useBlockLayoutDefaults } from '~stackable/hooks'
1616
1717/**
1818 * WordPress dependencies
@@ -39,6 +39,8 @@ export const Icon = props => (
3939 hasIconGap = { props . hasIconGap }
4040 hasIconPosition = { props . hasIconPosition }
4141 defaultValue = { props . defaultValue }
42+ iconSizePlaceholderName = "--stk-button-icon-size"
43+ iconGapPlaceholderName = { props . iconGapPlaceholderName }
4244 />
4345)
4446
@@ -176,10 +178,13 @@ Colors.defaultProps = {
176178const SizeControls = props => {
177179 const {
178180 attrNameTemplate = 'button%s' ,
181+ paddingPlaceholderName = '--stk-button-padding' ,
179182 } = props
180183
181184 const getAttrName = getAttributeNameFunc ( attrNameTemplate )
185+ const { getPlaceholder } = useBlockLayoutDefaults ( )
182186
187+ const buttonPaddingPlaceholder = getPlaceholder ( paddingPlaceholderName , { single : false } )
183188 return ( < >
184189 { props . hasFullWidth && (
185190 < AdvancedToggleControl
@@ -193,6 +198,7 @@ const SizeControls = props => {
193198 attribute = { getAttrName ( 'minHeight' ) }
194199 min = { 0 }
195200 max = { 100 }
201+ placeholder = { getPlaceholder ( '--stk-button-min-height' ) }
196202 />
197203 { props . hasWidth && ! props . hasFullWidth && (
198204 < AdvancedRangeControl
@@ -213,6 +219,10 @@ const SizeControls = props => {
213219 sliderMin = { [ 0 , 0 ] }
214220 sliderMax = { [ 40 , 100 ] }
215221 vhMode = { true }
222+ placeholderTop = { buttonPaddingPlaceholder ?. top || '' }
223+ placeholderRight = { buttonPaddingPlaceholder ?. right || '' }
224+ placeholderBottom = { buttonPaddingPlaceholder ?. bottom || '' }
225+ placeholderLeft = { buttonPaddingPlaceholder ?. left || '' }
216226 helpTooltip = { {
217227 // TODO: Add a working video
218228 title : __ ( 'Button padding' , i18n ) ,
@@ -240,11 +250,21 @@ Size.defaultProps = {
240250}
241251
242252const BorderControls = props => {
253+ const className = useBlockAttributesContext ( attributes => {
254+ return attributes . className
255+ } )
256+ const { getPlaceholder } = useBlockLayoutDefaults ( )
257+
258+ const borderWidthPlaceholder = className === 'is-style-ghost' ? getPlaceholder ( '--stk-button-ghost-border-width' ) : getPlaceholder ( '--stk-button-border-width' )
259+
243260 return (
244261 < _BorderControls
245262 hasBorderRadiusHover = { false }
246263 borderSelector = { props . borderSelector }
247264 borderRadiusPlaceholder = { props . placeholder }
265+ borderTypeValue = { getPlaceholder ( '--stk-button-border-style' ) }
266+ borderWidthPlaceholder = { borderWidthPlaceholder }
267+ placeholderTemplate = "--stk-button"
248268 { ...props }
249269 />
250270 )
@@ -281,6 +301,7 @@ export const Edit = props => {
281301 hasIconPosition,
282302 borderRadiusPlaceholder,
283303 hasFullWidth,
304+ iconGapPlaceholderName,
284305 ...propsToPass
285306 } = props
286307
@@ -312,6 +333,7 @@ export const Edit = props => {
312333 < Icon
313334 hasIconGap = { hasIconGap }
314335 hasIconPosition = { hasIconPosition }
336+ iconGapPlaceholderName = { iconGapPlaceholderName }
315337 />
316338 ) }
317339 </ >
@@ -326,6 +348,7 @@ Edit.defaultProps = {
326348 hasIconGap : true ,
327349 hasIconPosition : true ,
328350 hasFullWidth : false ,
351+ iconGapPlaceholderName : undefined ,
329352}
330353
331354Edit . Link = Link
0 commit comments