Display label within input using selected colour

[MAILPOET-2908]
This commit is contained in:
Pavel Dohnal
2020-05-18 10:54:28 +02:00
committed by Veljko V
parent e77f1380f9
commit 0555cc94d9

View File

@@ -53,19 +53,39 @@ const TextInputEdit = ({
inputStyles.backgroundColor = styles.backgroundColor; inputStyles.backgroundColor = styles.backgroundColor;
} }
const getTextInput = (placeholder) => ( const placeholderStyle = {};
<input
id={id} if (styles.fontColor && !styles.inheritFromTheme) {
ref={input} inputStyles.color = styles.fontColor;
className="mailpoet_text" if (labelWithinInput) {
type={name === 'email' ? 'email' : 'text'} placeholderStyle.color = styles.fontColor;
name={name} }
placeholder={placeholder} }
data-automation-id={`editor_${name}_input`}
style={inputStyles} const getTextInput = (placeholder) => {
onFocus={() => input.current.blur()} let style = '';
/> if (placeholderStyle.color !== undefined) {
); style = `#${id}::placeholder {color: ${placeholderStyle.color};}`;
}
return (
<>
<style>
{style}
</style>
<input
id={id}
ref={input}
className="mailpoet_text"
type={name === 'email' ? 'email' : 'text'}
name={name}
placeholder={placeholder}
data-automation-id={`editor_${name}_input`}
style={inputStyles}
onFocus={() => input.current.blur()}
/>
</>
);
};
return ( return (
<ParagraphEdit className={className}> <ParagraphEdit className={className}>