Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form state update, index update #301

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ interface RadioOption {
items: RadioOption[];
dataTestid?: string;
ariaLabel?: string;
indexValue?: number;
}

export const CustomRadioButton: React.FC<CustomRadioButtonProps> = ({
items,
dataTestid = "",
ariaLabel = "",
indexValue = 0,
}) => {
return (
<Form className="custom-radio-button" aria-label={ariaLabel}>
Expand All @@ -29,7 +31,7 @@ export const CustomRadioButton: React.FC<CustomRadioButtonProps> = ({
id={`inline-radio-${index + 1}`}
data-testid={`${dataTestid}-inline-radio-${index + 1}`}
key={`radio-${index + 1}`}
defaultChecked={index === 0}
defaultChecked={index === indexValue}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onchange is common handler for selection

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class name is empty

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is value prop in this radio btton

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of passing indexValue do we need to pass the value to make sure default check. @arun-s-aot

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree to that. index checking can be replaced with value checking @Bonymol-aot

onClick={option.onClick}
/>
))}
Expand Down
1 change: 1 addition & 0 deletions forms-flow-nav/src/sidenav/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const Sidebar = React.memo(({ props }) => {
const { pathname } = location;
const isAuthenticated = instance?.isAuthenticated();
const showApplications = setShowApplications(userDetail?.groups);
const [form, setForm] = React.useState({});

const getInitials = (name) => {
if (!name) return "";
Expand Down