Skip to content

Add Checkbox question type#25

Open
miles-grant-ibigroup wants to merge 4 commits into
devfrom
checkboxes
Open

Add Checkbox question type#25
miles-grant-ibigroup wants to merge 4 commits into
devfrom
checkboxes

Conversation

@miles-grant-ibigroup
Copy link
Copy Markdown
Collaborator

Screenshot 2024-10-08 at 2 26 04 PM

Curious for feedback on styling. Tried to optimize for longer answer lengths.

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
arc-deviation-survey ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2024 4:40pm
arc-survey ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2024 4:40pm
atlrides-survey ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2024 4:40pm
qa-survey ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2024 4:40pm
st-survey ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2024 4:40pm

Copy link
Copy Markdown
Contributor

@amy-corson-ibigroup amy-corson-ibigroup left a comment

Choose a reason for hiding this comment

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

Beautiful checkboxes! A few things but nothing blocking

Comment thread components/stories/Checkboxes.story.tsx
Comment thread styles/Checkboxes.module.css Outdated
Comment thread styles/Checkboxes.module.css Outdated
Comment thread package.json
Copy link
Copy Markdown
Contributor

@daniel-heppner-ibigroup daniel-heppner-ibigroup left a comment

Choose a reason for hiding this comment

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

Let's avoid useEffect whenever possible!

Comment thread components/Checkboxes.tsx
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[selectedOptions]
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't use useEffect here. Just make a callback function that calls updateSelectedOptions and updateCallback and call that function from line 35 where you call updateSelectedOptions now

Comment thread components/Checkboxes.tsx
[selectedOptions]
)

const uuid = v4()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hmmm. Does this cause the id to change on every rerender? Like when a box is checked and unchecked?

Comment thread components/Checkboxes.tsx
type="checkbox"
value={index}
/>
<span className={styles.label} id={`${option}-label`}>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you are using option for the ID here then why not use it for the key on label too instead of index?

Comment thread components/Checkboxes.tsx
className={styles.button}
defaultChecked={selectedOptions[index] === true}
disabled={disabled}
id={`${uuid}-${index}`}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not just use option or option-index?

@miles-grant-ibigroup
Copy link
Copy Markdown
Collaborator Author

Putting this on hold for now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants