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

Add a switch component to toggle between v1 and v2 keypads #630

Merged
merged 2 commits into from
Jul 27, 2023

Conversation

handeyeco
Copy link
Contributor

@handeyeco handeyeco commented Jul 26, 2023

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:

  • Right now nothing should change
  • Tests should pass
  • Manually tested this in Storybook

@changeset-bot
Copy link

changeset-bot bot commented Jul 26, 2023

🦋 Changeset detected

Latest commit: e7a3335

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@khanacademy/math-input Major
@khanacademy/perseus Patch
@khanacademy/perseus-editor Patch

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

@handeyeco handeyeco self-assigned this Jul 26, 2023
@khan-actions-bot khan-actions-bot requested a review from a team July 26, 2023 18:44
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Jul 26, 2023

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/quick-tables-tell.md, packages/math-input/src/full-math-input.stories.tsx, packages/math-input/src/index.ts, packages/math-input/src/components/keypad-switch.tsx, packages/perseus/src/mixins/provide-keypad.tsx, packages/perseus/src/widgets/__stories__/test-keypad-context-wrapper.tsx

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

@handeyeco handeyeco changed the title add a switch component between v1 and v2 keypads Add a switch component to toggle between v1 and v2 keypads Jul 26, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 26, 2023

Size Change: -483 B (0%)

Total Size: 824 kB

Filename Size Change
packages/math-input/dist/es/index.js 79 kB -476 B (-1%)
packages/perseus/dist/es/index.js 397 kB -7 B (0%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38 kB
packages/kmath/dist/es/index.js 4.13 kB
packages/perseus-core/dist/es/index.js 55 B
packages/perseus-editor/dist/es/index.js 268 kB
packages/perseus-error/dist/es/index.js 705 B
packages/perseus-linter/dist/es/index.js 21.2 kB
packages/pure-markdown/dist/es/index.js 3.65 kB
packages/simple-markdown/dist/es/index.js 12.6 kB

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented Jul 26, 2023

npm Snapshot: Published

🎉 Good news!! We've packaged up the latest commit from this PR (25d7c21) and published it to npm. You
can install it using the tag PR630.

Example:

yarn add @khanacademy/perseus@PR630

import {LegacyKeypad} from "@khanacademy/math-input";
import {Keypad} from "@khanacademy/math-input";
Copy link
Collaborator

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.

@handeyeco handeyeco merged commit e21926c into v2-keypad-api-option Jul 27, 2023
18 checks passed
@handeyeco handeyeco deleted the switch-between-keypads branch July 27, 2023 18:00
handeyeco added a commit that referenced this pull request Jul 27, 2023
* 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
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