Skip to content

Commit

Permalink
Correct renderCustom. Adjust labels #69
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Oct 17, 2024
1 parent aac18f9 commit 31e7ca2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/oik-dashicon/SVGSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ function renderOption( icon ) {
function renderCustom( icon ) {
var label = icon && icon.name ? icon.name : icon;
//var iconValue = icon && icon.icon ? <Icon icon={icon.icon} /> : <Icon icon={icon} />
var iconValue = icon && icon.icon ? icon.icon : <Icon icon={icon} />;
var iconValue = ( icon && icon.icon ) ? <Icon icon={icon.icon } /> : <Icon icon={icon} />;
var option = { 'key': label, 'name': iconValue };
return option;
}

function SVGSelectControl( { value, onChange, ...props }) {
var SVGoptions = dashiconslist.map( ( icon ) => renderOption( icon ) );
return <SelectControl label={__("Icon", 'oik-bob-bing-wide')} value={value} options={ SVGoptions } onChange={onChange }/>;
return <SelectControl label={__("Icon select", 'oik-bob-bing-wide')} value={value} options={ SVGoptions } onChange={onChange }/>;
}

function SVGComboboxControl( { value, onChange, ...props } ) {
var SVGoptions = dashiconslist.map( ( icon ) => renderOption( icon ) );
return <ComboboxControl label={__("Icon", 'oik-bob-bing-wide')}value={value} options={ SVGoptions } onChange={onChange }/>;
return <ComboboxControl label={__("Icon combo", 'oik-bob-bing-wide')}value={value} options={ SVGoptions } onChange={onChange }/>;
}

/**
Expand All @@ -51,7 +51,7 @@ function SVGCustomSelectControl( { value, setAttributes, ...props } ) {
//console.log( SVGoptions );
var selectedValue= SVGoptions.find( (option ) => option.key === value ) ;

return <CustomSelectControl label={__("Icon", 'oik-bob-bing-wide')} value={ selectedValue } options={ SVGoptions }
return <CustomSelectControl label={__("Icon custom select", 'oik-bob-bing-wide')} value={ selectedValue } options={ SVGoptions }
onChange={ ( { selectedItem } ) => setAttributes( { dashicon: selectedItem.key } ) }/>;
}

Expand Down

0 comments on commit 31e7ca2

Please sign in to comment.