-
Notifications
You must be signed in to change notification settings - Fork 351
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
Add a switch component to toggle between v1 and v2 keypads #630
Conversation
🦋 Changeset detectedLatest commit: e7a3335 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
Size Change: -483 B (0%) Total Size: 824 kB
ℹ️ View Unchanged
|
npm Snapshot: Published🎉 Good news!! We've packaged up the latest commit from this PR (25d7c21) and published it to npm. You Example: yarn add @khanacademy/perseus@PR630 |
import {LegacyKeypad} from "@khanacademy/math-input"; | ||
import {Keypad} from "@khanacademy/math-input"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice outcome for this PR. As we begin removing the Legacy Keypad, perseus will be impacted less and less.
* add useV2Keypad API option * changeset * remove name from TODO * Add a switch component to toggle between v1 and v2 keypads (#630) * add a switch component between v1 and v2 keypads * changeset * really remove name this time
Summary:
So originally I thought I would just switch between the v1 and v2 keypads in Webapp using a feature flag when I thought the keypads were exclusively rendered in footers. When I tried that, I realized that ArticleRenderer uses ProvideKeypad and thus renders the keypad internally in Perseus.
To make things simple-ish, I decided to just export one keypad from MathInput: a wrapper around both LegacyKeypad and MobileKeypad with a new prop to switch between them. Then I used the new API Option from #629 to switch in ProvideKeypad.
Next step is to use this new switching keypad in webapp where we render the keypad in the footer (for ServerItemRenderer) and add the
useV2Keypad
API option (for Item/ArticleRenderer) - both of which will be true/false depending on the feature flag.Test plan: