@khanacademy/math-input 4.2.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/components/input/mathquill-types.d.ts +2 -0
- package/dist/components/input/mathquill-types.js.flow +2 -0
- package/dist/components/keypad/index.d.ts +8 -16
- package/dist/components/keypad/index.js.flow +10 -22
- package/dist/components/keypad/keypad-button.d.ts +12 -0
- package/dist/components/keypad/keypad-button.js.flow +18 -0
- package/dist/components/keypad/keypad-pages/extras-page.d.ts +9 -0
- package/dist/components/keypad/{operators-page/basic-relations-buttons.js.flow → keypad-pages/extras-page.js.flow} +3 -3
- package/dist/components/keypad/keypad-pages/geometry-page.d.ts +7 -0
- package/dist/components/keypad/{operators-page/logarithms-buttons.js.flow → keypad-pages/geometry-page.js.flow} +1 -3
- package/dist/components/keypad/keypad-pages/numbers-page.d.ts +7 -0
- package/dist/components/keypad/{operators-page/pre-algebra-buttons.js.flow → keypad-pages/numbers-page.js.flow} +1 -3
- package/dist/components/keypad/keypad-pages/operators-page.d.ts +11 -0
- package/dist/components/keypad/{operators-page/advanced-relations-buttons.js.flow → keypad-pages/operators-page.js.flow} +5 -3
- package/dist/components/keypad/shared-keys.d.ts +9 -0
- package/dist/components/keypad/{numbers-page/types.js.flow → shared-keys.js.flow} +4 -1
- package/dist/es/index.js +771 -842
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +834 -930
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
- package/src/components/input/__tests__/test-math-wrapper.ts +2 -5
- package/src/components/input/mathquill-types.ts +6 -0
- package/src/components/keypad/__tests__/keypad-button.test.tsx +4 -2
- package/src/components/keypad/button-assets.tsx +506 -310
- package/src/components/keypad/index.tsx +73 -49
- package/src/components/keypad/{button.stories.tsx → keypad-button.stories.tsx} +2 -1
- package/src/components/keypad/keypad-button.tsx +128 -0
- package/src/components/keypad/keypad-mathquill.stories.tsx +10 -4
- package/src/components/keypad/keypad-pages/extras-page.tsx +34 -0
- package/src/components/keypad/keypad-pages/geometry-page.tsx +33 -0
- package/src/components/keypad/keypad-pages/numbers-page.tsx +84 -0
- package/src/components/keypad/keypad-pages/operators-page.tsx +116 -0
- package/src/components/keypad/keypad.stories.tsx +11 -0
- package/src/components/keypad/shared-keys.tsx +78 -0
- package/src/components/tabbar/icons.tsx +26 -8
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/components/keypad/button.d.ts +0 -12
- package/dist/components/keypad/button.js.flow +0 -18
- package/dist/components/keypad/extras-page/index.d.ts +0 -10
- package/dist/components/keypad/extras-page/index.js.flow +0 -15
- package/dist/components/keypad/geometry-page/index.d.ts +0 -9
- package/dist/components/keypad/geometry-page/index.js.flow +0 -14
- package/dist/components/keypad/keypad-page-items.d.ts +0 -26
- package/dist/components/keypad/keypad-page-items.js.flow +0 -40
- package/dist/components/keypad/numbers-page/index.d.ts +0 -10
- package/dist/components/keypad/numbers-page/index.js.flow +0 -18
- package/dist/components/keypad/numbers-page/types.d.ts +0 -4
- package/dist/components/keypad/operators-page/advanced-relations-buttons.d.ts +0 -8
- package/dist/components/keypad/operators-page/basic-relations-buttons.d.ts +0 -8
- package/dist/components/keypad/operators-page/index.d.ts +0 -10
- package/dist/components/keypad/operators-page/index.js.flow +0 -18
- package/dist/components/keypad/operators-page/logarithms-buttons.d.ts +0 -8
- package/dist/components/keypad/operators-page/pre-algebra-buttons.d.ts +0 -8
- package/dist/components/keypad/operators-page/types.d.ts +0 -6
- package/dist/components/keypad/operators-page/types.js.flow +0 -12
- package/src/components/keypad/__tests__/Button.test.tsx +0 -51
- package/src/components/keypad/button.tsx +0 -108
- package/src/components/keypad/extras-page/index.tsx +0 -27
- package/src/components/keypad/geometry-page/index.tsx +0 -89
- package/src/components/keypad/keypad-page-items.tsx +0 -118
- package/src/components/keypad/numbers-page/index.tsx +0 -136
- package/src/components/keypad/numbers-page/types.ts +0 -4
- package/src/components/keypad/operators-page/advanced-relations-buttons.tsx +0 -33
- package/src/components/keypad/operators-page/basic-relations-buttons.tsx +0 -33
- package/src/components/keypad/operators-page/index.tsx +0 -94
- package/src/components/keypad/operators-page/logarithms-buttons.tsx +0 -33
- package/src/components/keypad/operators-page/pre-algebra-buttons.tsx +0 -37
- package/src/components/keypad/operators-page/types.ts +0 -6
- /package/src/components/keypad/{keypad-pages.stories.tsx → keypad-pages/keypad-pages.stories.tsx} +0 -0
|
@@ -8,35 +8,27 @@ import {ClickKeyCallback} from "../../types";
|
|
|
8
8
|
import Tabbar from "../tabbar/tabbar";
|
|
9
9
|
import {TabbarItemType} from "../tabbar/types";
|
|
10
10
|
|
|
11
|
-
import ExtrasPage from "./extras-page";
|
|
12
|
-
import GeometryPage from "./geometry-page";
|
|
13
|
-
import NumbersPage from "./numbers-page";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {OperatorsButtonSets} from "./operators-page/types";
|
|
11
|
+
import ExtrasPage from "./keypad-pages/extras-page";
|
|
12
|
+
import GeometryPage from "./keypad-pages/geometry-page";
|
|
13
|
+
import NumbersPage from "./keypad-pages/numbers-page";
|
|
14
|
+
import OperatorsPage from "./keypad-pages/operators-page";
|
|
15
|
+
import SharedKeys from "./shared-keys";
|
|
17
16
|
|
|
18
17
|
export type Props = {
|
|
19
18
|
onClickKey: ClickKeyCallback;
|
|
20
19
|
trigonometry?: boolean;
|
|
21
20
|
extraKeys: ReadonlyArray<Key>;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
type DefaultProps = {
|
|
30
|
-
extraKeys: Props["extraKeys"];
|
|
21
|
+
multiplicationDot?: boolean;
|
|
22
|
+
divisionKey?: boolean;
|
|
23
|
+
preAlgebra?: boolean;
|
|
24
|
+
logarithms?: boolean;
|
|
25
|
+
basicRelations?: boolean;
|
|
26
|
+
advancedRelations?: boolean;
|
|
31
27
|
};
|
|
32
28
|
|
|
33
29
|
function allPages(props: Props): ReadonlyArray<TabbarItemType> {
|
|
34
30
|
const pages: Array<TabbarItemType> = ["Numbers"];
|
|
35
31
|
|
|
36
|
-
if (props.extraKeys?.length) {
|
|
37
|
-
pages.push("Extras");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
32
|
if (
|
|
41
33
|
// OperatorsButtonSets
|
|
42
34
|
props.preAlgebra ||
|
|
@@ -51,48 +43,80 @@ function allPages(props: Props): ReadonlyArray<TabbarItemType> {
|
|
|
51
43
|
pages.push("Geometry");
|
|
52
44
|
}
|
|
53
45
|
|
|
46
|
+
if (props.extraKeys?.length) {
|
|
47
|
+
pages.push("Extras");
|
|
48
|
+
}
|
|
49
|
+
|
|
54
50
|
return pages;
|
|
55
51
|
}
|
|
56
52
|
|
|
57
|
-
export default
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
{
|
|
53
|
+
export default function Keypad(props: Props) {
|
|
54
|
+
const [selectedPage, setSelectedPage] =
|
|
55
|
+
React.useState<TabbarItemType>("Numbers");
|
|
56
|
+
|
|
57
|
+
const availablePages = allPages(props);
|
|
58
|
+
|
|
59
|
+
const {
|
|
60
|
+
onClickKey,
|
|
61
|
+
extraKeys = [],
|
|
62
|
+
multiplicationDot,
|
|
63
|
+
divisionKey,
|
|
64
|
+
preAlgebra,
|
|
65
|
+
logarithms,
|
|
66
|
+
basicRelations,
|
|
67
|
+
advancedRelations,
|
|
68
|
+
} = props;
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<View>
|
|
72
|
+
<Tabbar
|
|
73
|
+
items={availablePages}
|
|
74
|
+
selectedItem={selectedPage}
|
|
75
|
+
onSelectItem={(tabbarItem: TabbarItemType) => {
|
|
76
|
+
setSelectedPage(tabbarItem);
|
|
77
|
+
}}
|
|
78
|
+
style={styles.tabbar}
|
|
79
|
+
/>
|
|
80
|
+
|
|
81
|
+
<View style={styles.grid}>
|
|
82
|
+
{selectedPage === "Numbers" && (
|
|
83
|
+
<NumbersPage onClickKey={onClickKey} />
|
|
84
|
+
)}
|
|
85
|
+
{selectedPage === "Extras" && (
|
|
86
|
+
<ExtrasPage onClickKey={onClickKey} extraKeys={extraKeys} />
|
|
87
|
+
)}
|
|
83
88
|
{selectedPage === "Operators" && (
|
|
84
|
-
<OperatorsPage
|
|
89
|
+
<OperatorsPage
|
|
90
|
+
onClickKey={onClickKey}
|
|
91
|
+
preAlgebra={preAlgebra}
|
|
92
|
+
logarithms={logarithms}
|
|
93
|
+
basicRelations={basicRelations}
|
|
94
|
+
advancedRelations={advancedRelations}
|
|
95
|
+
/>
|
|
85
96
|
)}
|
|
86
97
|
{selectedPage === "Geometry" && (
|
|
87
|
-
<GeometryPage {
|
|
98
|
+
<GeometryPage onClickKey={onClickKey} />
|
|
88
99
|
)}
|
|
100
|
+
<SharedKeys
|
|
101
|
+
onClickKey={onClickKey}
|
|
102
|
+
multiplicationDot={multiplicationDot}
|
|
103
|
+
divisionKey={divisionKey}
|
|
104
|
+
/>
|
|
89
105
|
</View>
|
|
90
|
-
|
|
91
|
-
|
|
106
|
+
</View>
|
|
107
|
+
);
|
|
92
108
|
}
|
|
93
109
|
|
|
94
110
|
const styles = StyleSheet.create({
|
|
95
111
|
tabbar: {
|
|
96
112
|
background: Color.white,
|
|
97
113
|
},
|
|
114
|
+
grid: {
|
|
115
|
+
display: "grid",
|
|
116
|
+
gridTemplateColumns: "repeat(6, 1fr)",
|
|
117
|
+
gridTemplateRows: "repeat(4, 1fr)",
|
|
118
|
+
backgroundColor: "#DBDCDD",
|
|
119
|
+
maxHeight: 200,
|
|
120
|
+
maxWidth: 300,
|
|
121
|
+
},
|
|
98
122
|
});
|
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
|
|
5
5
|
import KeyConfigs from "../../data/key-configs";
|
|
6
6
|
|
|
7
|
-
import {KeypadButton, KeypadButtonProps} from "./keypad-
|
|
7
|
+
import {KeypadButton, KeypadButtonProps} from "./keypad-button";
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
title: "Keypad Button",
|
|
@@ -70,6 +70,7 @@ export const AllButtons: ComponentStory<typeof KeypadButton> = ({
|
|
|
70
70
|
<KeypadButton
|
|
71
71
|
keyConfig={KeyConfigs[key]}
|
|
72
72
|
onClickKey={action("pressed")}
|
|
73
|
+
coord={[0, 0]}
|
|
73
74
|
/>
|
|
74
75
|
</div>
|
|
75
76
|
))}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import Clickable from "@khanacademy/wonder-blocks-clickable";
|
|
2
|
+
import Color from "@khanacademy/wonder-blocks-color";
|
|
3
|
+
import {View} from "@khanacademy/wonder-blocks-core";
|
|
4
|
+
import {StyleSheet} from "aphrodite";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
|
|
7
|
+
import {KeyConfig, ClickKeyCallback} from "../../types";
|
|
8
|
+
|
|
9
|
+
import ButtonAsset from "./button-assets";
|
|
10
|
+
|
|
11
|
+
import type {StyleType} from "@khanacademy/wonder-blocks-core";
|
|
12
|
+
|
|
13
|
+
export type KeypadButtonProps = {
|
|
14
|
+
// 0 indexed [x, y] position in keypad CSS grid
|
|
15
|
+
coord: readonly [number, number];
|
|
16
|
+
keyConfig: KeyConfig;
|
|
17
|
+
onClickKey: ClickKeyCallback;
|
|
18
|
+
// Apply action button styles
|
|
19
|
+
action?: boolean;
|
|
20
|
+
// Apply secondary button styles
|
|
21
|
+
secondary?: boolean;
|
|
22
|
+
style?: StyleType;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const KeypadButton = ({
|
|
26
|
+
coord,
|
|
27
|
+
keyConfig,
|
|
28
|
+
onClickKey,
|
|
29
|
+
style,
|
|
30
|
+
secondary,
|
|
31
|
+
action,
|
|
32
|
+
}: KeypadButtonProps): React.ReactElement => {
|
|
33
|
+
const tintColor = secondary ? "#F6F6F7" : action ? "#DBDCDD" : undefined;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<View
|
|
37
|
+
style={{
|
|
38
|
+
gridColumn: coord[0] + 1,
|
|
39
|
+
gridRow: coord[1] + 1,
|
|
40
|
+
...style,
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
<Clickable
|
|
44
|
+
onClick={() => onClickKey(keyConfig.id)}
|
|
45
|
+
style={styles.clickable}
|
|
46
|
+
aria-label={keyConfig.ariaLabel}
|
|
47
|
+
>
|
|
48
|
+
{({hovered, focused, pressed}) => {
|
|
49
|
+
return (
|
|
50
|
+
<View
|
|
51
|
+
style={[
|
|
52
|
+
styles.outerBoxBase,
|
|
53
|
+
hovered && styles.outerBoxHover,
|
|
54
|
+
pressed && styles.outerBoxPressed,
|
|
55
|
+
]}
|
|
56
|
+
>
|
|
57
|
+
<View
|
|
58
|
+
style={[
|
|
59
|
+
styles.base,
|
|
60
|
+
tintColor != null
|
|
61
|
+
? {background: tintColor}
|
|
62
|
+
: undefined,
|
|
63
|
+
hovered && styles.hovered,
|
|
64
|
+
focused && styles.focused,
|
|
65
|
+
pressed && styles.pressed,
|
|
66
|
+
]}
|
|
67
|
+
>
|
|
68
|
+
<ButtonAsset id={keyConfig.id} />
|
|
69
|
+
</View>
|
|
70
|
+
</View>
|
|
71
|
+
);
|
|
72
|
+
}}
|
|
73
|
+
</Clickable>
|
|
74
|
+
</View>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
base: {
|
|
80
|
+
display: "flex",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
boxShadow: "0px 1px 0px rgba(33, 36, 44, 0.32)",
|
|
84
|
+
boxSizing: "border-box",
|
|
85
|
+
background: Color.white,
|
|
86
|
+
borderRadius: 4,
|
|
87
|
+
border: `1px solid transparent`,
|
|
88
|
+
flex: 1,
|
|
89
|
+
minHeight: 42,
|
|
90
|
+
minWidth: 42,
|
|
91
|
+
padding: 1,
|
|
92
|
+
},
|
|
93
|
+
hovered: {
|
|
94
|
+
border: `1px solid ${Color.blue}`,
|
|
95
|
+
padding: 1,
|
|
96
|
+
boxShadow: "none",
|
|
97
|
+
},
|
|
98
|
+
focused: {
|
|
99
|
+
border: `2px solid ${Color.blue}`,
|
|
100
|
+
padding: 0,
|
|
101
|
+
boxShadow: "none",
|
|
102
|
+
},
|
|
103
|
+
pressed: {
|
|
104
|
+
border: "2px solid #1B50B3",
|
|
105
|
+
padding: 0,
|
|
106
|
+
background: `linear-gradient(0deg, rgba(24, 101, 242, 0.32), rgba(24, 101, 242, 0.32)), ${Color.white}`,
|
|
107
|
+
boxShadow: "none",
|
|
108
|
+
},
|
|
109
|
+
outerBoxBase: {
|
|
110
|
+
padding: 1,
|
|
111
|
+
height: "100%",
|
|
112
|
+
width: "100%",
|
|
113
|
+
boxSizing: "border-box",
|
|
114
|
+
borderRadius: 7,
|
|
115
|
+
border: "2px solid transparent",
|
|
116
|
+
},
|
|
117
|
+
outerBoxHover: {
|
|
118
|
+
border: `2px solid ${Color.blue}`,
|
|
119
|
+
},
|
|
120
|
+
outerBoxPressed: {
|
|
121
|
+
border: "2px solid #1B50B3",
|
|
122
|
+
},
|
|
123
|
+
clickable: {
|
|
124
|
+
width: "100%",
|
|
125
|
+
height: "100%",
|
|
126
|
+
boxSizing: "border-box",
|
|
127
|
+
},
|
|
128
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Color from "@khanacademy/wonder-blocks-color";
|
|
2
|
-
import {Popover} from "@khanacademy/wonder-blocks-popover";
|
|
2
|
+
import {Popover, PopoverContentCore} from "@khanacademy/wonder-blocks-popover";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
5
|
import Key from "../../data/keys";
|
|
@@ -44,9 +44,14 @@ export function V2KeypadWithMathquill() {
|
|
|
44
44
|
<div style={{maxWidth: "400px", margin: "2em"}}>
|
|
45
45
|
<Popover
|
|
46
46
|
content={
|
|
47
|
-
<
|
|
47
|
+
<PopoverContentCore
|
|
48
|
+
style={{
|
|
49
|
+
padding: 10,
|
|
50
|
+
maxWidth: "initial",
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
48
53
|
<Keypad
|
|
49
|
-
extraKeys={["
|
|
54
|
+
extraKeys={["x", "y", "PI", "THETA"]}
|
|
50
55
|
onClickKey={handleClickKey}
|
|
51
56
|
advancedRelations
|
|
52
57
|
basicRelations
|
|
@@ -56,9 +61,10 @@ export function V2KeypadWithMathquill() {
|
|
|
56
61
|
preAlgebra
|
|
57
62
|
trigonometry
|
|
58
63
|
/>
|
|
59
|
-
</
|
|
64
|
+
</PopoverContentCore>
|
|
60
65
|
}
|
|
61
66
|
dismissEnabled
|
|
67
|
+
opened
|
|
62
68
|
>
|
|
63
69
|
<div
|
|
64
70
|
style={{
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import Keys from "../../../data/key-configs";
|
|
4
|
+
import Key from "../../../data/keys";
|
|
5
|
+
import {ClickKeyCallback} from "../../../types";
|
|
6
|
+
import {KeypadButton} from "../keypad-button";
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
extraKeys: ReadonlyArray<Key>;
|
|
10
|
+
onClickKey: ClickKeyCallback;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const columns = 4;
|
|
14
|
+
|
|
15
|
+
export default function ExtrasPage(props: Props) {
|
|
16
|
+
const {extraKeys, onClickKey} = props;
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
{extraKeys.map((key, i) => {
|
|
20
|
+
// Map 1D array to Cartesian coordinates
|
|
21
|
+
const coordX = i % columns;
|
|
22
|
+
const coordY = i / columns;
|
|
23
|
+
return (
|
|
24
|
+
<KeypadButton
|
|
25
|
+
key={key}
|
|
26
|
+
keyConfig={Keys[key]}
|
|
27
|
+
onClickKey={onClickKey}
|
|
28
|
+
coord={[coordX, coordY]}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
})}
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import Keys from "../../../data/key-configs";
|
|
4
|
+
import {ClickKeyCallback} from "../../../types";
|
|
5
|
+
import {KeypadButton} from "../keypad-button";
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
onClickKey: ClickKeyCallback;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default function GeometryPage(props: Props) {
|
|
12
|
+
const {onClickKey} = props;
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
{/* Row 1 */}
|
|
16
|
+
<KeypadButton
|
|
17
|
+
keyConfig={Keys.SIN}
|
|
18
|
+
onClickKey={onClickKey}
|
|
19
|
+
coord={[0, 0]}
|
|
20
|
+
/>
|
|
21
|
+
<KeypadButton
|
|
22
|
+
keyConfig={Keys.COS}
|
|
23
|
+
onClickKey={onClickKey}
|
|
24
|
+
coord={[1, 0]}
|
|
25
|
+
/>
|
|
26
|
+
<KeypadButton
|
|
27
|
+
keyConfig={Keys.TAN}
|
|
28
|
+
onClickKey={onClickKey}
|
|
29
|
+
coord={[2, 0]}
|
|
30
|
+
/>
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import Keys from "../../../data/key-configs";
|
|
4
|
+
import {ClickKeyCallback} from "../../../types";
|
|
5
|
+
import {KeypadButton} from "../keypad-button";
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
onClickKey: ClickKeyCallback;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default function NumbersPage(props: Props) {
|
|
12
|
+
const {onClickKey} = props;
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
{/* Row 1 */}
|
|
16
|
+
<KeypadButton
|
|
17
|
+
keyConfig={Keys.NUM_7}
|
|
18
|
+
onClickKey={onClickKey}
|
|
19
|
+
coord={[0, 0]}
|
|
20
|
+
/>
|
|
21
|
+
<KeypadButton
|
|
22
|
+
keyConfig={Keys.NUM_8}
|
|
23
|
+
onClickKey={onClickKey}
|
|
24
|
+
coord={[1, 0]}
|
|
25
|
+
/>
|
|
26
|
+
<KeypadButton
|
|
27
|
+
keyConfig={Keys.NUM_9}
|
|
28
|
+
onClickKey={onClickKey}
|
|
29
|
+
coord={[2, 0]}
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
{/* Row 2 */}
|
|
33
|
+
<KeypadButton
|
|
34
|
+
keyConfig={Keys.NUM_4}
|
|
35
|
+
onClickKey={onClickKey}
|
|
36
|
+
coord={[0, 1]}
|
|
37
|
+
/>
|
|
38
|
+
<KeypadButton
|
|
39
|
+
keyConfig={Keys.NUM_5}
|
|
40
|
+
onClickKey={onClickKey}
|
|
41
|
+
coord={[1, 1]}
|
|
42
|
+
/>
|
|
43
|
+
<KeypadButton
|
|
44
|
+
keyConfig={Keys.NUM_6}
|
|
45
|
+
onClickKey={onClickKey}
|
|
46
|
+
coord={[2, 1]}
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
{/* Row 3 */}
|
|
50
|
+
<KeypadButton
|
|
51
|
+
keyConfig={Keys.NUM_1}
|
|
52
|
+
onClickKey={onClickKey}
|
|
53
|
+
coord={[0, 2]}
|
|
54
|
+
/>
|
|
55
|
+
<KeypadButton
|
|
56
|
+
keyConfig={Keys.NUM_2}
|
|
57
|
+
onClickKey={onClickKey}
|
|
58
|
+
coord={[1, 2]}
|
|
59
|
+
/>
|
|
60
|
+
<KeypadButton
|
|
61
|
+
keyConfig={Keys.NUM_3}
|
|
62
|
+
onClickKey={onClickKey}
|
|
63
|
+
coord={[2, 2]}
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
{/* Row 4 */}
|
|
67
|
+
<KeypadButton
|
|
68
|
+
keyConfig={Keys.NUM_0}
|
|
69
|
+
onClickKey={onClickKey}
|
|
70
|
+
coord={[0, 3]}
|
|
71
|
+
/>
|
|
72
|
+
<KeypadButton
|
|
73
|
+
keyConfig={Keys.DECIMAL}
|
|
74
|
+
onClickKey={onClickKey}
|
|
75
|
+
coord={[1, 3]}
|
|
76
|
+
/>
|
|
77
|
+
<KeypadButton
|
|
78
|
+
keyConfig={Keys.NEGATIVE}
|
|
79
|
+
onClickKey={onClickKey}
|
|
80
|
+
coord={[2, 3]}
|
|
81
|
+
/>
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import Keys from "../../../data/key-configs";
|
|
4
|
+
import {ClickKeyCallback} from "../../../types";
|
|
5
|
+
import {KeypadButton} from "../keypad-button";
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
onClickKey: ClickKeyCallback;
|
|
9
|
+
preAlgebra?: boolean;
|
|
10
|
+
logarithms?: boolean;
|
|
11
|
+
basicRelations?: boolean;
|
|
12
|
+
advancedRelations?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default function OperatorsPage(props: Props) {
|
|
16
|
+
const {
|
|
17
|
+
onClickKey,
|
|
18
|
+
preAlgebra,
|
|
19
|
+
logarithms,
|
|
20
|
+
basicRelations,
|
|
21
|
+
advancedRelations,
|
|
22
|
+
} = props;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
{/* Row 1 */}
|
|
27
|
+
{preAlgebra && (
|
|
28
|
+
<>
|
|
29
|
+
<KeypadButton
|
|
30
|
+
keyConfig={Keys.EXP_2}
|
|
31
|
+
onClickKey={onClickKey}
|
|
32
|
+
coord={[0, 0]}
|
|
33
|
+
/>
|
|
34
|
+
<KeypadButton
|
|
35
|
+
keyConfig={Keys.EXP}
|
|
36
|
+
onClickKey={onClickKey}
|
|
37
|
+
coord={[1, 0]}
|
|
38
|
+
/>
|
|
39
|
+
<KeypadButton
|
|
40
|
+
keyConfig={Keys.SQRT}
|
|
41
|
+
onClickKey={onClickKey}
|
|
42
|
+
coord={[2, 0]}
|
|
43
|
+
/>
|
|
44
|
+
<KeypadButton
|
|
45
|
+
keyConfig={Keys.RADICAL}
|
|
46
|
+
onClickKey={onClickKey}
|
|
47
|
+
coord={[3, 0]}
|
|
48
|
+
/>
|
|
49
|
+
</>
|
|
50
|
+
)}
|
|
51
|
+
|
|
52
|
+
{/* Row 2 */}
|
|
53
|
+
{logarithms && (
|
|
54
|
+
<>
|
|
55
|
+
<KeypadButton
|
|
56
|
+
keyConfig={Keys.LOG}
|
|
57
|
+
onClickKey={onClickKey}
|
|
58
|
+
coord={[0, 1]}
|
|
59
|
+
/>
|
|
60
|
+
<KeypadButton
|
|
61
|
+
keyConfig={Keys.LOG_N}
|
|
62
|
+
onClickKey={onClickKey}
|
|
63
|
+
coord={[1, 1]}
|
|
64
|
+
/>
|
|
65
|
+
<KeypadButton
|
|
66
|
+
keyConfig={Keys.LN}
|
|
67
|
+
onClickKey={onClickKey}
|
|
68
|
+
coord={[2, 1]}
|
|
69
|
+
/>
|
|
70
|
+
</>
|
|
71
|
+
)}
|
|
72
|
+
|
|
73
|
+
{/* Row 3 */}
|
|
74
|
+
{basicRelations && (
|
|
75
|
+
<>
|
|
76
|
+
<KeypadButton
|
|
77
|
+
keyConfig={Keys.EQUAL}
|
|
78
|
+
onClickKey={onClickKey}
|
|
79
|
+
coord={[0, 2]}
|
|
80
|
+
/>
|
|
81
|
+
<KeypadButton
|
|
82
|
+
keyConfig={Keys.LT}
|
|
83
|
+
onClickKey={onClickKey}
|
|
84
|
+
coord={[1, 2]}
|
|
85
|
+
/>
|
|
86
|
+
<KeypadButton
|
|
87
|
+
keyConfig={Keys.GT}
|
|
88
|
+
onClickKey={onClickKey}
|
|
89
|
+
coord={[2, 2]}
|
|
90
|
+
/>
|
|
91
|
+
</>
|
|
92
|
+
)}
|
|
93
|
+
|
|
94
|
+
{/* Row 4 */}
|
|
95
|
+
{advancedRelations && (
|
|
96
|
+
<>
|
|
97
|
+
<KeypadButton
|
|
98
|
+
keyConfig={Keys.NEQ}
|
|
99
|
+
onClickKey={onClickKey}
|
|
100
|
+
coord={[0, 3]}
|
|
101
|
+
/>
|
|
102
|
+
<KeypadButton
|
|
103
|
+
keyConfig={Keys.LEQ}
|
|
104
|
+
onClickKey={onClickKey}
|
|
105
|
+
coord={[1, 3]}
|
|
106
|
+
/>
|
|
107
|
+
<KeypadButton
|
|
108
|
+
keyConfig={Keys.GEQ}
|
|
109
|
+
onClickKey={onClickKey}
|
|
110
|
+
coord={[2, 3]}
|
|
111
|
+
/>
|
|
112
|
+
</>
|
|
113
|
+
)}
|
|
114
|
+
</>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
@@ -89,3 +89,14 @@ Trigonometry.args = {
|
|
|
89
89
|
preAlgebra: true,
|
|
90
90
|
trigonometry: true,
|
|
91
91
|
};
|
|
92
|
+
|
|
93
|
+
export const Everything = Template.bind({});
|
|
94
|
+
Everything.args = {
|
|
95
|
+
advancedRelations: true,
|
|
96
|
+
basicRelations: true,
|
|
97
|
+
divisionKey: true,
|
|
98
|
+
logarithms: true,
|
|
99
|
+
multiplicationDot: false,
|
|
100
|
+
preAlgebra: true,
|
|
101
|
+
trigonometry: true,
|
|
102
|
+
};
|