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

Small storybook fixes #767

Merged
merged 6 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/stale-carpets-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/math-input": patch
---

Small comment fixes in the math keypad
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {action} from "@storybook/addon-actions";
import {withKnobs} from "@storybook/addon-knobs";
import {INITIAL_VIEWPORTS} from "@storybook/addon-viewport";
import * as React from "react";

import GeometryInputPage from "./geometry-page";
Expand All @@ -13,7 +14,7 @@ export default {
backgrounds: {
values: [{name: "light background", value: "white", default: true}],
},
viewport: {defaultViewport: "iphone6"},
viewport: {defaultViewport: "iphone6", viewports: INITIAL_VIEWPORTS},
},
};

Expand All @@ -22,7 +23,13 @@ export const NumericInput = (): React.ReactElement => (
);

export const PreAlgebraInput = (): React.ReactElement => (
<PrealgebraInputPage onClickKey={action("onClickKey")} />
<PrealgebraInputPage
onClickKey={action("onClickKey")}
preAlgebra={true}
logarithms={true}
basicRelations={true}
advancedRelations={true}
Comment on lines +28 to +31
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Without these, this story doesn't show anything!

/>
);

export const TrigonometryInput = (): React.ReactElement => (
Expand Down
4 changes: 2 additions & 2 deletions packages/math-input/src/components/keypad/keypad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function getAvailableTabs(props: Props): ReadonlyArray<KeypadPageType> {
// The main (v2) Keypad. Use this component to present an accessible, onscreen
// keypad to learners for entering math expressions.
export default function Keypad(props: Props) {
// If we're using the Fractions keyapd, we want to default select that page
// If we're using the Fractions keypad, we want to default select that page
// Otherwise, we want to default to the Numbers page
const defaultSelectedPage = props.fractionsOnly ? "Fractions" : "Numbers";
const [selectedPage, setSelectedPage] =
Expand Down Expand Up @@ -105,7 +105,7 @@ export default function Keypad(props: Props) {
? styles.fractionsGrid
: styles.expressionGrid;

// This useeffect is only used to ensure that we can test the keypad in storybook
// This useEffect is only used to ensure that we can test the keypad in storybook
useEffect(() => {
setSelectedPage(defaultSelectedPage);
}, [fractionsOnly, defaultSelectedPage]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {action} from "@storybook/addon-actions";
import * as React from "react";

import NavigationPad from "./navigation-pad";
Expand All @@ -19,7 +20,7 @@ export default {
export function basic() {
return (
<div style={{padding: 50}}>
<NavigationPad onClickKey={() => {}} />
<NavigationPad onClickKey={action("onClickKey")} />
</div>
);
}
8 changes: 7 additions & 1 deletion packages/math-input/src/full-keypad.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ export default {

const Template: ComponentStory<typeof Keypad> = (
args: PropsFor<typeof Keypad>,
): React.ReactElement => <Keypad {...args} onClickKey={action("onClickKey")} />;
): React.ReactElement => (
<Keypad
{...args}
onClickKey={action("onClickKey")}
onAnalyticsEvent={async (e) => action("onAnalyticsEvent")(e)}
/>
);

export const Default = Template.bind({});

Expand Down
Loading