Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/block/icon-list-item/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}

// Apply the color to the SVG path on the defintion
svg.ugb-custom-icon :is(g,path,rect,polygon,ellipse) {
&:not(.stk__use-custom-icon-color) svg:where(.ugb-custom-icon) :is(g,path,rect,polygon,ellipse) {
fill: var(--stk-icon-list-marker-color) !important;
color: var(--stk-icon-list-marker-color) !important;
}
Expand Down Expand Up @@ -48,17 +48,22 @@
width: var(--stk-icon-height, var(--stk-icon-list-icon-size, 16px));
transform: rotate(var(--stk-icon-list-icon-rotation, 0deg));
opacity: var(--stk-icon-list-icon-opacity, 1);
fill: var(--stk-icon-list-marker-color);
color: var(--stk-icon-list-marker-color);
position: relative;

:is(use,g,path,rect,polygon,ellipse) {
fill: var(--stk-icon-list-marker-color);
color: var(--stk-icon-list-marker-color);
}
}
}
}
}

.stk-block-icon-list:not(.stk__use-custom-icon-color) .stk-block-icon-list__ul .stk-block-icon-list-item .stk-block-icon-list-item__content {
.stk--inner-svg svg {
fill: var(--stk-icon-list-marker-color);
color: var(--stk-icon-list-marker-color);

:is(use,g,path,rect,polygon,ellipse) {
fill: var(--stk-icon-list-marker-color);
color: var(--stk-icon-list-marker-color);
}
}
}

Expand Down
17 changes: 14 additions & 3 deletions src/block/icon-list/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import { dispatch, useSelect } from '@wordpress/data'
import { addFilter } from '@wordpress/hooks'
import { memo } from '@wordpress/element'
import { useBlockLayoutDefaults } from '~stackable/hooks'
import { ToggleControl } from '@wordpress/components'

const ALLOWED_INNER_BLOCKS = [ 'stackable/icon-list-item' ]

Expand Down Expand Up @@ -143,6 +144,7 @@ const Edit = props => {
listItemBorderColor,
listDisplayStyle,
listFullWidth,
useCustomIconColor,
} = attributes

const wrapList = ! listFullWidth && listDisplayStyle !== 'grid'
Expand All @@ -163,7 +165,9 @@ const Edit = props => {
'stk-block-icon-list',
blockAlignmentClass,
textClasses,
] )
], {
'stk__use-custom-icon-color': useCustomIconColor,
} )

const tagNameClassNames = classnames( [
ordered ? 'stk-block-icon-list__ol' : 'stk-block-icon-list__ul',
Expand Down Expand Up @@ -209,6 +213,7 @@ const Edit = props => {
listItemBorderStyle={ listItemBorderStyle }
listItemBorderColor={ listItemBorderColor }
resetCustomIcons={ resetCustomIcons }
useCustomIconColor={ useCustomIconColor }
/>

{ blockCss && <style key="block-css">{ blockCss }</style> }
Expand Down Expand Up @@ -339,7 +344,7 @@ const InspectorControls = memo( props => {
default="unordered"
/>

{ ! props.ordered && (
{ ! props.ordered && <>
<IconControl
label={ __( 'Icon', i18n ) }
value={ props.icon }
Expand All @@ -350,7 +355,13 @@ const InspectorControls = memo( props => {
} }
defaultValue={ DEFAULT_SVG }
/>
) }

<ToggleControl
label={ __( 'Use Custom Icon Color', i18n ) }
checked={ props.useCustomIconColor }
onChange={ useCustomIconColor => props.setAttributes( { useCustomIconColor } ) }
/>
</> }

{ props.ordered && (
<AdvancedSelectControl
Expand Down
10 changes: 10 additions & 0 deletions src/block/icon-list/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ export const attributes = ( version = VERSION ) => {
versionAdded: '3.0.0',
versionDeprecated: '',
} )
attrObject.add( {
attributes: {
useCustomIconColor: {
type: 'boolean',
default: false,
},
},
versionAdded: '3.14.4',
versionDeprecated: '',
} )

return attrObject.getMerged( version )
}
Expand Down
Loading