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

feat: add stepper component #718

Merged
merged 12 commits into from
Dec 7, 2023
Merged

feat: add stepper component #718

merged 12 commits into from
Dec 7, 2023

Conversation

mikezzb
Copy link
Contributor

@mikezzb mikezzb commented Dec 3, 2023

Fixes #708

Created a stepper component that will enhance the user experience and reduce the complexity of current multistep forms.

Features

  • Support controlled (parent component controls the steps) & uncontrolled mode (children controls the step)
  • Support parent monitoring for uncontrolled mode using onComplete or onStepChanged
  • Added generic type WithStep<T> as an interface for stepper children

Example:

  • Refactored EditDocumentForm using the new stepper

Copy link

vercel bot commented Dec 3, 2023

@mikezzb is attempting to deploy a commit to the Documenso Team Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Dec 3, 2023

Important

Auto Review Skipped

Auto reviews are limited to the following labels: coderabbit. Please add one of these labels to enable auto reviews.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

@Mythie
Copy link
Collaborator

Mythie commented Dec 3, 2023

Hey there, it looks like you haven't accepted our contributor license agreement yet. In order for us to accept your pull request we ask that you please fill out the CLA:

https://documen.so/cla

@mikezzb
Copy link
Contributor Author

mikezzb commented Dec 3, 2023

Should we integrate the next / prev button and the step progress bar inside Stepper or let the Stepper children handle it? I can modify it based on the updated design and will add more documentation and example usage after the design is confirmed.

@Mythie
Copy link
Collaborator

Mythie commented Dec 3, 2023

Should we integrate the next / prev button and the step progress bar inside Stepper or let the Stepper children handle it? I can modify it based on the updated design and will add more documentation and example usage after the design is confirmed.

Ideally stepper children would handle it which would be another argument for having it via context, overall this is the start of a nice solution but needs a bit of refinement before it can be accepted.

My ideal solution provides the kind of API described in the issue where my children can deal with most of their logic removing the need for the current "document flow" that is mostly a bandaid around not having this component/api.

@Mythie
Copy link
Collaborator

Mythie commented Dec 3, 2023

As mentioned on the other PR, yourself and #720 are both bringing some fantastic ideas on how to solve this. I reckon working together would net an amazing result, hope ya'll consider it! 🙌

import type { FC } from 'react';

type StepContextType = {
stepIndex: number;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps we also need an isCompleting or similar context value for forms that have async complete actions!

@Mythie
Copy link
Collaborator

Mythie commented Dec 3, 2023

This is likely going to be the winner, sorry @G3root 💚

The API looks fine, code is looking great just a minor tweak to add a property and some questions around how we can remove some of nasty document flow cruft.

Would love a loom but it's not totally required.

@Mythie Mythie changed the title feat: Stepper component feat: add stepper component Dec 7, 2023
@Mythie Mythie merged commit 328b2e7 into documenso:main Dec 7, 2023
7 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[OSSHACK] Create a Stepper component
3 participants