import React, { Fragment } from 'react';
import Field from 'Modal/field';
import { __wpupg } from 'Shared/Translations';
const ButtonStyle = (props) => {
const { style } = props;
const states = props.hasOwnProperty( 'states' ) ? props.states : {
default: __wpupg( 'Default' ),
active: __wpupg( 'Active' ),
hover: __wpupg( 'Hover' ),
};
const getColorsForStates = ( prefix ) => {
let colors = [];
for ( let state of Object.keys( states ) ) {
const key = 'default' === state ? '' : state;
const label = states[ state ];
const option = `${prefix}_${ key ? key + '_' : '' }color`;
colors.push({
label,
value: style[ option ],
onChange: ( value ) => { props.onChange({ [ option ]: value }); }
});
}
return colors;
};
return (
{ props.onChange({ font_size: value }); } }
type="number"
min="0"
label={ __wpupg( 'Font Size' ) }
suffix="px"
/>
{ props.onChange({ border_width: value }); } }
type="number"
min="0"
label={ __wpupg( 'Border Width' ) }
suffix="px"
/>
{
0 < style.border_width
&&
}
{ props.onChange({ border_radius: value }); } }
type="number"
min="0"
label={ __wpupg( 'Border Radius' ) }
suffix="px"
/>
{
props.onChange({ margin_vertical: e.target.value });
}}
/> px ({ __wpupg( 'vertical' ) })
,
{
props.onChange({ margin_horizontal: e.target.value });
}}
/> px ({ __wpupg( 'horizontal' ) })
]}
label={ __wpupg( 'Margin' ) }
/>
{
props.onChange({ padding_vertical: e.target.value });
}}
/> px ({ __wpupg( 'vertical' ) })
,
{
props.onChange({ padding_horizontal: e.target.value });
}}
/> px ({ __wpupg( 'horizontal' ) })
]}
label={ __wpupg( 'Padding' ) }
/>
{ props.onChange({ alignment: value }); }}
type="dropdown"
options={[
{
value: 'left',
label: __wpupg( 'Left' ),
},
{
value: 'center',
label: __wpupg( 'Center' ),
},
{
value: 'right',
label: __wpupg( 'Right' ),
},
]}
label={ __wpupg( 'Alignment' ) }
/>
{
props.hasOwnProperty( 'hasIcon' )
&& props.hasIcon
&&
{ props.onChange({ icon_position: value }); }}
type="dropdown"
options={[
{
value: 'before',
label: __wpupg( 'Before Text' ),
},
{
value: 'after',
label: __wpupg( 'After Text' ),
},
]}
label={ __wpupg( 'Icon Position' ) }
/>
}
);
}
export default ButtonStyle;