Skip to content

OBPIH-6101 Create a reusable Switch component#4492

Merged
awalkowiak merged 4 commits intofeature/product-supplier-list-redesignfrom
OBPIH-6101
Feb 7, 2024
Merged

OBPIH-6101 Create a reusable Switch component#4492
awalkowiak merged 4 commits intofeature/product-supplier-list-redesignfrom
OBPIH-6101

Conversation

@alannadolny
Copy link
Collaborator

No description provided.

};

return (
<div id="switch-container">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why you are using id here? What if there are going to be multiple switch fields on the form for some usecase?

<div id="switch-container">
<label htmlFor="toggle" className="switch">
<input
id="toggle"
Copy link
Collaborator

@awalkowiak awalkowiak Feb 6, 2024

Choose a reason for hiding this comment

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

I feel like this could use some sort of additional part of id passed in props 🤔


import './style.scss';

const Switch = ({ defaultValue, titles, onChange }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be ready to receive the ...field prop from the react-hook-form. I can't exactly say now what all the props will be, so for now let's at least add it as ...rest (let's name it as ...fieldProps).

@awalkowiak awalkowiak merged commit 077222e into feature/product-supplier-list-redesign Feb 7, 2024
@awalkowiak awalkowiak deleted the OBPIH-6101 branch February 7, 2024 14:19
awalkowiak pushed a commit that referenced this pull request Mar 12, 2024
* OBPIH-6101 Add images for slider

* OBPIH-6101 Add switch component and styling

* OBPIH-6101 Changes after reviews

* OBPIH-6101 Add unique ids to toggles
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.

4 participants