mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 00:48:25 +00:00
Added default value for backgroundColor In NumberInput (#4378)
* fix: added background styles for number input * fix: removed additional f from the background color property * fix: added backgroundColor property from styles * fixes: default bg color for dark mode Co-authored-by: arpitnath <arpitnath42@gmail.com> Co-authored-by: Kavin Venkatachalam <kavin.saratha@gmail.com>
This commit is contained in:
parent
fcbc5fbc03
commit
e1ef96ce7a
2 changed files with 17 additions and 9 deletions
|
|
@ -9,7 +9,7 @@ export const NumberInput = function NumberInput({
|
|||
darkMode,
|
||||
fireEvent,
|
||||
}) {
|
||||
const { visibility, borderRadius, borderColor } = styles;
|
||||
const { visibility, borderRadius, borderColor, backgroundColor } = styles;
|
||||
|
||||
const textColor = darkMode && ['#232e3c', '#000000ff'].includes(styles.textColor) ? '#fff' : styles.textColor;
|
||||
|
||||
|
|
@ -43,6 +43,15 @@ export const NumberInput = function NumberInput({
|
|||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [value]);
|
||||
|
||||
const computedStyles = {
|
||||
height,
|
||||
display: visibility ? '' : 'none',
|
||||
borderRadius: `${borderRadius}px`,
|
||||
borderColor,
|
||||
color: textColor,
|
||||
backgroundColor: darkMode && ['#ffffff', '#ffffffff'].includes(backgroundColor) ? '#000000' : backgroundColor,
|
||||
};
|
||||
|
||||
return (
|
||||
<input
|
||||
disabled={styles.disabledState}
|
||||
|
|
@ -50,13 +59,7 @@ export const NumberInput = function NumberInput({
|
|||
type="number"
|
||||
className="form-control"
|
||||
placeholder={properties.placeholder}
|
||||
style={{
|
||||
height,
|
||||
display: visibility ? '' : 'none',
|
||||
borderRadius: `${borderRadius}px`,
|
||||
borderColor,
|
||||
color: textColor,
|
||||
}}
|
||||
style={computedStyles}
|
||||
value={value}
|
||||
data-cy={`draggable-widget-${String(component.name).toLowerCase()}`}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1100,6 +1100,10 @@ export const widgets = [
|
|||
schema: { type: 'union', schemas: [{ type: 'string' }, { type: 'number' }] },
|
||||
},
|
||||
},
|
||||
backgroundColor: {
|
||||
type: 'color',
|
||||
displayName: 'Background Color',
|
||||
},
|
||||
borderColor: {
|
||||
type: 'color',
|
||||
displayName: 'Border Color',
|
||||
|
|
@ -1132,6 +1136,7 @@ export const widgets = [
|
|||
visibility: { value: '{{true}}' },
|
||||
disabledState: { value: '{{false}}' },
|
||||
borderRadius: { value: '{{0}}' },
|
||||
backgroundColor: { value: '#ffffffff' },
|
||||
borderColor: { value: '#fff' },
|
||||
textColor: { value: '#232e3c' },
|
||||
},
|
||||
|
|
@ -1220,7 +1225,7 @@ export const widgets = [
|
|||
visibility: { value: '{{true}}' },
|
||||
disabledState: { value: '{{false}}' },
|
||||
borderRadius: { value: '{{0}}' },
|
||||
backgroundColor: { value: '#fff' },
|
||||
backgroundColor: { value: '#ffffff' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue