mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 01:18:23 +00:00
feat: Add customizable border color for text input component (#4191)
* feat: Add customizable border color for text input component * Update widgetConfig.js * chore: Fix linter issues
This commit is contained in:
parent
0853685c24
commit
0c895e2e4e
2 changed files with 14 additions and 3 deletions
|
|
@ -13,13 +13,18 @@ export const TextInput = function TextInput({
|
||||||
}) {
|
}) {
|
||||||
const textInputRef = useRef();
|
const textInputRef = useRef();
|
||||||
|
|
||||||
const textColor = darkMode && styles.textColor === '#000' ? '#fff' : styles.textColor;
|
|
||||||
|
|
||||||
const [disable, setDisable] = useState(styles.disabledState);
|
const [disable, setDisable] = useState(styles.disabledState);
|
||||||
const [value, setValue] = useState(properties.value);
|
const [value, setValue] = useState(properties.value);
|
||||||
const [visibility, setVisibility] = useState(styles.visibility);
|
const [visibility, setVisibility] = useState(styles.visibility);
|
||||||
const { isValid, validationError } = validate(value);
|
const { isValid, validationError } = validate(value);
|
||||||
|
|
||||||
|
const computedStyles = {
|
||||||
|
height,
|
||||||
|
borderRadius: `${styles.borderRadius}px`,
|
||||||
|
color: darkMode && styles.textColor === '#000' ? '#fff' : styles.textColor,
|
||||||
|
borderColor: styles.borderColor,
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
disable !== styles.disabledState && setDisable(styles.disabledState);
|
disable !== styles.disabledState && setDisable(styles.disabledState);
|
||||||
}, [styles.disabledState]);
|
}, [styles.disabledState]);
|
||||||
|
|
@ -98,7 +103,7 @@ export const TextInput = function TextInput({
|
||||||
darkMode && 'dark-theme-placeholder'
|
darkMode && 'dark-theme-placeholder'
|
||||||
}`}
|
}`}
|
||||||
placeholder={properties.placeholder}
|
placeholder={properties.placeholder}
|
||||||
style={{ height, borderRadius: `${styles.borderRadius}px`, color: textColor }}
|
style={computedStyles}
|
||||||
value={value}
|
value={value}
|
||||||
data-cy={`draggable-widget-${String(component.name).toLowerCase()}`}
|
data-cy={`draggable-widget-${String(component.name).toLowerCase()}`}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -954,6 +954,11 @@ export const widgets = [
|
||||||
displayName: 'Text Color',
|
displayName: 'Text Color',
|
||||||
validation: { schema: { type: 'string' } },
|
validation: { schema: { type: 'string' } },
|
||||||
},
|
},
|
||||||
|
borderColor: {
|
||||||
|
type: 'color',
|
||||||
|
displayName: 'Border Color',
|
||||||
|
validation: { schema: { type: 'string' } },
|
||||||
|
},
|
||||||
borderRadius: {
|
borderRadius: {
|
||||||
type: 'code',
|
type: 'code',
|
||||||
displayName: 'Border radius',
|
displayName: 'Border radius',
|
||||||
|
|
@ -1012,6 +1017,7 @@ export const widgets = [
|
||||||
events: [],
|
events: [],
|
||||||
styles: {
|
styles: {
|
||||||
textColor: { value: '#000' },
|
textColor: { value: '#000' },
|
||||||
|
borderColor: { value: '#dadcde' },
|
||||||
borderRadius: { value: '{{0}}' },
|
borderRadius: { value: '{{0}}' },
|
||||||
visibility: { value: '{{true}}' },
|
visibility: { value: '{{true}}' },
|
||||||
disabledState: { value: '{{false}}' },
|
disabledState: { value: '{{false}}' },
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue