-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Interactive Graph] Add example function area for locked function set…
…tings (#1600) ## Summary: Having a list of sample functions available to quickly copy/paste into the locked function settings can be very helpful for content creators. This PR adds that capability, along with an updatable file (locked-function-examples.ts) for adding/modifying example functions. Issue: LEMS-1948 ## Test plan: 1. Launch Storybook (yarn start) 2. Navigate to Perseus Editor => Editor => [Demo Interactive Graph](http://localhost:6006/?path=/story/perseuseditor-editor--demo-interactive-graph) 3. Open the "interactive-graph 1" widget settings 4. Click on the "Add locked figure" drop-down at the bottom of the editor and choose "Function" 5. Below the "domain min/max" fields there is an "examples" dropdown, and instructions to the right. 6. Choose an example category from the dropdown. * Note that the instructions are replaced by examples for that category. * Currently, there are only 2 examples per category, but if you edit the DOM and add another list item, you can see that the area's height is limited, and you can scroll to see the additional example(s). 7. Copy one of the examples by clicking on the copy icon to the left of the example that you want. 8. Paste the contents of the clipboard into the equation field (above the domain min/max section). ## Affected UI ### New settings feature ![Example Equations - Updated](https://github.com/user-attachments/assets/473382e8-72eb-443d-aa61-4585f8da96c9) Author: mark-fitzgerald Reviewers: nishasy, mark-fitzgerald, #perseus Required Reviewers: Approved By: nishasy Checks: ❌ codecov/project, ✅ codecov/patch, ✅ Upload Coverage (ubuntu-latest, 20.x), ✅ Jest Coverage (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ gerald Pull Request URL: #1600
- Loading branch information
1 parent
08068dc
commit bdb382f
Showing
4 changed files
with
309 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@khanacademy/perseus-editor": minor | ||
--- | ||
|
||
Interactive Graph - Add example functions for copy/paste to locked functions settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/perseus-editor/src/components/graph-locked-figures/locked-function-examples.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const examples: {[k: string]: string[]} = { | ||
linear: ["x + 5", "1/2x - 2"], | ||
polynomial: ["1/2x^2 + 3x - 4", "(1/3)x^3 - 2x^2 + 3x - 4"], | ||
trigonometric: ["sin(x) * 3", "arctan(2x) + 4"], | ||
}; | ||
|
||
export default examples; |
Oops, something went wrong.