@@ -36,6 +36,25 @@ export const BORDER_CONTROLS = [
3636 } ,
3737]
3838
39+ const BORDER_CONTROLS_WITH_NONE_VALUE = [
40+ {
41+ value : 'none' ,
42+ title : __ ( 'None' , i18n ) ,
43+ } ,
44+ {
45+ value : 'solid' ,
46+ title : __ ( 'Solid' , i18n ) ,
47+ } ,
48+ {
49+ value : 'dashed' ,
50+ title : __ ( 'Dashed' , i18n ) ,
51+ } ,
52+ {
53+ value : 'dotted' ,
54+ title : __ ( 'Dotted' , i18n ) ,
55+ } ,
56+ ]
57+
3958export const BorderControls = props => {
4059 const {
4160 getAttribute,
@@ -47,14 +66,18 @@ export const BorderControls = props => {
4766
4867 const borderTypeValue = getAttribute ( 'borderType' ) || props . borderTypeValue
4968
69+ const hasBorderType = borderTypeValue !== '' && borderTypeValue !== 'none'
70+
71+ const borderControls = getPlaceholder ( `${ props . placeholderTemplate } -border-style` ) !== '' ? BORDER_CONTROLS_WITH_NONE_VALUE : BORDER_CONTROLS
72+
5073 applyFilters ( 'stackable.block-component.helpers.borders' , null , getAttribute , updateAttributes )
5174
5275 return (
5376 < Fragment >
5477 { props . hasBorderType &&
5578 < AdvancedToolbarControl
5679 label = { __ ( 'Borders' , i18n ) }
57- controls = { BORDER_CONTROLS }
80+ controls = { borderControls }
5881 className = "ugb-border-controls__border-type-toolbar"
5982 attribute = { getAttrName ( 'borderType' ) }
6083 fullwidth = { true }
@@ -63,7 +86,7 @@ export const BorderControls = props => {
6386 />
6487 }
6588
66- { borderTypeValue && props . hasBorderControls &&
89+ { hasBorderType && props . hasBorderControls &&
6790 < FourRangeControl
6891 label = { __ ( 'Border Width' , i18n ) }
6992 attribute = { getAttrName ( 'borderWidth' ) }
@@ -78,7 +101,7 @@ export const BorderControls = props => {
78101 />
79102 }
80103
81- { borderTypeValue && props . hasBorderControls &&
104+ { hasBorderType && props . hasBorderControls &&
82105 < ColorPaletteControl
83106 label = { __ ( 'Border Color' , i18n ) }
84107 attribute = { getAttrName ( 'borderColor' ) }
0 commit comments