Skip to content

Commit 64b48c7

Browse files
committed
fix: pr comments
1 parent dade035 commit 64b48c7

File tree

7 files changed

+26
-24
lines changed

7 files changed

+26
-24
lines changed

src/Common/RJSF/Form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export const RJSFForm = (props: FormProps) => (
3333
noHtml5Validate
3434
showErrorList={false}
3535
autoComplete="off"
36-
className={`rjsf-root-css ${props.className}`}
3736
{...props}
37+
className={`rjsf-form-template__container ${props.className || ''}`}
3838
validator={validator}
3939
templates={{
4040
...templates,

src/Common/RJSF/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ export const DEFAULT_FIELD_TITLE = 'Key not available'
2424

2525
// Using symbol to ensure uniqueness across the fields
2626
export const DO_NOT_SHOW_LABEL = Symbol('Do not show label')
27+
28+
export const ADD_BUTTON_WIDTH = {
29+
MAX_WIDTH_VALUE: 250,
30+
MAX_WIDTH_CLASSNAME: 'dc__mxw-250',
31+
}

src/Common/RJSF/rjsfForm.scss

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
.rjsf-root-css #root {
2-
margin-right: 28px;
3-
padding: 20px;
1+
.rjsf-form-template {
2+
&__container {
3+
margin-right: 28px;
4+
padding: 20px;
45

5-
input.form__input {
6-
padding: 6px 8px;
6+
input.form__input {
7+
padding: 6px 8px;
8+
}
79
}
8-
}
910

10-
.rjsf-form-template {
1111
&__field {
1212
grid-template-columns: 250px 1fr;
1313
}
@@ -26,11 +26,11 @@
2626
margin: 0;
2727
}
2828

29-
&:has(> .remove-btn-container:hover)::after {
29+
&:has(> .remove-btn__container:hover)::after {
3030
background: var(--R50);
3131
}
3232

33-
&:has(> .remove-btn-container)::after {
33+
&:has(> .remove-btn__container)::after {
3434
border-radius: 4px;
3535
transform: translate(-50%, -50%);
3636
top: 50%;
@@ -44,18 +44,14 @@
4444
transition: all 100ms ease-out;
4545
}
4646

47-
& > .remove-btn-container:hover {
47+
& > .remove-btn__container:hover {
4848
stroke: var(--R500);
4949
path {
5050
stroke: var(--R500);
5151
}
5252
}
5353

54-
& > .remove-btn-container {
55-
stroke: var(--R500);
56-
path {
57-
stroke: var(--R500);
58-
}
54+
& > .remove-btn__container {
5955
transition: all 100ms ease-out;
6056
}
6157
}

src/Common/RJSF/templates/ArrayFieldItemTemplate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const ArrayFieldItemTemplate = ({
3434
return (
3535
<div className="dc__position-rel display-grid rjsf-form-template__array-field-item flex-align-center mb-12">
3636
{children}
37-
<div className="dc__position-abs remove-btn-container" style={{ right: "-28px", top: "9px" }}>
37+
<div className="dc__position-abs remove-btn__container" style={{ right: "-28px", top: "9px" }}>
3838
{hasToolbar && hasRemove && (
3939
<RemoveButton
4040
disabled={disabled || readonly}

src/Common/RJSF/templates/ButtonTemplates/AddButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { IconButtonProps } from '@rjsf/utils'
1919

2020
import { ConditionalWrap } from '../../../Helper'
2121
import { getTippyWrapperWithContent } from '../../utils'
22+
import { ADD_BUTTON_WIDTH } from '../../constants'
2223
import { ReactComponent as PlusIcon } from '../../../../Assets/Icon/ic-add.svg'
2324

2425
export const AddButton = ({
@@ -33,7 +34,7 @@ export const AddButton = ({
3334
const buttonRef = useRef<HTMLButtonElement>(null)
3435
const content = `Add ${label}`
3536

36-
useEffect(() => setShowTippy(buttonRef.current?.offsetWidth >= 250), [buttonRef.current])
37+
useEffect(() => setShowTippy(buttonRef.current?.offsetWidth >= ADD_BUTTON_WIDTH.MAX_WIDTH_VALUE), [buttonRef.current])
3738

3839
return (
3940
<div className="flexbox flex-justify-start">
@@ -42,7 +43,7 @@ export const AddButton = ({
4243
ref={buttonRef}
4344
{...props}
4445
type="button"
45-
className="dc__outline-none-imp p-0 dc__transparent flex dc__gap-4 cursor dc__mxw-250"
46+
className={`dc__outline-none-imp p-0 dc__transparent flex dc__gap-4 cursor ${ADD_BUTTON_WIDTH.MAX_WIDTH_CLASSNAME}`}
4647
title="Add"
4748
>
4849
<PlusIcon className="icon-dim-16 fcb-5" />

src/Common/RJSF/templates/ButtonTemplates/RemoveButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { IconButtonProps } from '@rjsf/utils'
2020
import { ReactComponent as CrossIcon } from '../../../../Assets/Icon/ic-cross.svg'
2121

2222
export const RemoveButton = ({ icon, iconType, registry, uiSchema, ...props }: IconButtonProps) => (
23-
<button {...props} type="button" className="dc__outline-none-imp p-0 dc__transparent scn-6 flex cursor" title="Remove">
24-
<CrossIcon className="icon-dim-16 fcr-5" />
23+
<button {...props} type="button" className="dc__outline-none-imp p-0 dc__transparent flex cursor" title="Remove">
24+
<CrossIcon className="icon-dim-16 scn-6" />
2525
</button>
2626
)

src/Common/RJSF/templates/FieldErrorTemplate.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ export const FieldErrorTemplate = ({ errors = [], idSchema }: FieldErrorProps) =
2828
{errors
2929
.filter((elem) => !!elem)
3030
.map((error, index: number) => (
31-
<>
31+
<React.Fragment key={index}>
3232
<span />
33-
<span className="form__error" key={index}>
33+
<span className="form__error">
3434
<Error className="form__icon form__icon--error" />
3535
{error}
3636
</span>
37-
</>
37+
</React.Fragment>
3838
))}
3939
</span>
4040
)

0 commit comments

Comments
 (0)