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

Render steps conditionally with a ternary #105

Closed
erikmellum opened this issue Jul 24, 2021 · 2 comments
Closed

Render steps conditionally with a ternary #105

erikmellum opened this issue Jul 24, 2021 · 2 comments

Comments

@erikmellum
Copy link

erikmellum commented Jul 24, 2021

First of all - thank you for the library. The demo on the readme showcases a lot of useful features. I was able to drop this into my app and get it all working with minimal effort. I did run into one hiccup in my use case that I thought someone may know about.

I noticed this similar issue, but didn't find a clear resolution: #35

It seems reasonable that I would be able to do the following:

Step id="category">
                                <h1 className="text-align-center">I'm interested in...</h1>
                                <RadioGroup name="category" selectedValue={category} onChange={setCategory}>
                                  <div><Radio value="repair" />Computer, Printer, Internet Service</div>
                                  <div><Radio value="development" />Software / Website Design</div>
                                  <div><Radio value="subscription" />Service Contract</div>
                                  <div><Radio value="appointment" />Onsite Appointment</div>
                                </RadioGroup>
                              </Step>
                              { category === 'repair' ? <Step id="repair">
                                <RadioGroup name="category" selectedValue={repair} onChange={setRepair}>
                                  <div><Radio value="investigation" />Investigation</div>
                                  <div><Radio value="virus" />Virus Removal</div>
                                  <div><Radio value="internet" />Internet</div>
                                  <div><Radio value="printer" />Printer</div>
                                  <div><Radio value="data" />Data</div>
                                </RadioGroup>
                              </Step>
                              : '' }
                              { category === 'development' ? <Step id="development">
                                <RadioGroup name="category" selectedValue={development} onChange={setDevelopment}>
                                  <div><Radio value="website" />Website</div>
                                  <div><Radio value="desktop" />Desktop Application</div>
                                  <div><Radio value="mobile" />Mobile App</div>
                                </RadioGroup>
                              </Step>
                              : '' }
                              { category === 'subscription' ? <Step id="subscription">
                                <RadioGroup name="subscription" selectedValue={development} onChange={setDevelopment}>
                                  <div><Radio value="device" />Device Maintenance</div>
                                  <div><Radio value="hosting" />Web Hosting</div>
                                  <div><Radio value="oncall" />On Call</div>
                                </RadioGroup>
                              </Step>
                              : '' }

image

Are there any recommendations on how to handle this functionality? I want my wizard to react to decisions from previous steps, it's a must have for my use case and also just making the code easy to maintain. I discovered the library tonight so I'm not familiar with implementation details. Hoping someone can shed some light on this use case. Thanks!

@ryhinchey
Copy link
Contributor

@erikmellum this is your best bet right now but we're working on fixing this for a v3 release.

#35 (comment)

@erikmellum
Copy link
Author

Thank you @ryhinchey, I can work with that for now! Excited to see that upcoming v3 release. Thanks again for the project.

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

No branches or pull requests

2 participants