Skip to content

Commit 3e48e07

Browse files
authored
feat: Align multi json design with search attr updates (#1054)
* Search attribute component Signed-off-by: Assem Hafez <assem.hafez@uber.com> * Fix type check Signed-off-by: Assem Hafez <assem.hafez@uber.com> * revert errors to have key and value Signed-off-by: Assem Hafez <assem.hafez@uber.com> * Address the nits * change button label * Create hook for fetching search attributes Signed-off-by: Assem Hafez <assem.hafez@uber.com> * Refactor error message helpers * align multi json add button design with search attributes * remove extra test file --------- Signed-off-by: Assem Hafez <assem.hafez@uber.com>
1 parent db2b4bb commit 3e48e07

File tree

2 files changed

+15
-32
lines changed

2 files changed

+15
-32
lines changed

src/components/multi-json-input/multi-json-input.styles.ts

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,45 +24,30 @@ const cssStylesObj = {
2424
container: (theme) => ({
2525
display: 'flex',
2626
flexDirection: 'column',
27-
gap: '16px',
27+
gap: theme.sizing.scale600,
2828
borderLeft: `2px solid ${theme.colors.borderOpaque}`,
29-
paddingLeft: '16px',
29+
paddingLeft: theme.sizing.scale600,
3030
}),
31-
inputRow: {
31+
inputRow: (theme) => ({
3232
display: 'flex',
33-
gap: '8px',
33+
gap: theme.sizing.scale300,
3434
alignItems: 'flex-start',
35-
},
35+
}),
3636
inputContainer: {
3737
flex: 1,
3838
},
39-
buttonContainer: {
39+
buttonContainer: (theme) => ({
4040
display: 'flex',
4141
alignItems: 'flex-start',
4242
justifyContent: 'center',
4343
minWidth: '40px',
44-
paddingTop: '4px',
45-
},
46-
deleteButton: {
47-
padding: '8px',
48-
borderRadius: '8px',
49-
},
44+
paddingTop: theme.sizing.scale100,
45+
}),
5046
addButtonContainer: {
5147
display: 'flex',
5248
justifyContent: 'flex-start',
5349
alignItems: 'flex-start',
5450
},
55-
addButton: {
56-
padding: '6px 12px',
57-
fontSize: '12px',
58-
fontWeight: '500',
59-
lineHeight: '16px',
60-
},
61-
plusIcon: {
62-
fontSize: '16px',
63-
fontWeight: '500',
64-
lineHeight: '1',
65-
},
6651
} satisfies StyletronCSSObject;
6752

6853
export const cssStyles: StyletronCSSObjectOf<typeof cssStylesObj> =

src/components/multi-json-input/multi-json-input.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'use client';
22
import React, { useCallback, useMemo } from 'react';
33

4-
import { Button, SHAPE, SIZE } from 'baseui/button';
4+
import { Button } from 'baseui/button';
55
import { FormControl } from 'baseui/form-control';
66
import { Textarea } from 'baseui/textarea';
7-
import { MdDeleteOutline } from 'react-icons/md';
7+
import { MdAdd, MdDeleteOutline } from 'react-icons/md';
88

99
import useStyletronClasses from '@/hooks/use-styletron-classes';
1010

@@ -91,20 +91,19 @@ export default function MultiJsonInput({
9191
value={inputValue}
9292
onChange={(e) => handleInputChange(index, e.target.value)}
9393
placeholder={placeholder}
94-
size={SIZE.compact}
94+
size="compact"
9595
error={getInputError(index)}
9696
/>
9797
</div>
9898
<div className={cls.buttonContainer}>
9999
<Button
100-
size={SIZE.mini}
100+
size="mini"
101101
kind="tertiary"
102102
shape="circle"
103103
onClick={() => {
104104
handleDeleteInput(index);
105105
}}
106106
disabled={isDeleteDisabled}
107-
className={cls.deleteButton}
108107
aria-label={
109108
displayValue.length === 1 ? 'Clear input' : 'Delete input'
110109
}
@@ -116,13 +115,12 @@ export default function MultiJsonInput({
116115
))}
117116
<div className={cls.addButtonContainer}>
118117
<Button
119-
size={SIZE.mini}
118+
size="mini"
120119
kind="secondary"
121-
shape={SHAPE.pill}
120+
shape="pill"
122121
onClick={handleAddInput}
123122
disabled={!canAddMore}
124-
className={cls.addButton}
125-
startEnhancer={<span className={cls.plusIcon}>+</span>}
123+
startEnhancer={<MdAdd size={16} />}
126124
>
127125
{addButtonText}
128126
</Button>

0 commit comments

Comments
 (0)