Skip to content

Commit

Permalink
update keypad to include scientific button only on first tab
Browse files Browse the repository at this point in the history
  • Loading branch information
anakaren-rojas committed Dec 27, 2024
1 parent e33414a commit c733c2f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import type {ClickKeyCallback} from "../../../types";

type Props = {
onClickKey: ClickKeyCallback;
scientific?: boolean;
};

export default function NumbersPage(props: Props) {
const {onClickKey} = props;
export default function NumbersPage({onClickKey, scientific}: Props) {
const {strings} = useMathInputI18n();
const Keys = KeyConfigs(strings);
// These keys are arranged sequentially so that tabbing follows numerical order. This
Expand Down Expand Up @@ -92,6 +92,14 @@ export default function NumbersPage(props: Props) {
coord={[3, 0]}
secondary
/>
{scientific && (
<KeypadButton
keyConfig={Keys.EXP}
onClickKey={onClickKey}
coord={[3, 2]}
secondary
/>
)}
</>
);
}
6 changes: 4 additions & 2 deletions packages/math-input/src/components/keypad/keypad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ export default function Keypad({extraKeys = [], ...props}: Props) {
/>
)}
{selectedPage === "Numbers" && (
<NumbersPage onClickKey={onClickKey} />
<NumbersPage
onClickKey={onClickKey}
scientific={scientific}
/>
)}
{selectedPage === "Extras" && (
<ExtrasPage
Expand All @@ -184,7 +187,6 @@ export default function Keypad({extraKeys = [], ...props}: Props) {
convertDotToTimes={convertDotToTimes}
divisionKey={divisionKey}
selectedPage={selectedPage}
scientific={scientific}
/>
)}
</View>
Expand Down
10 changes: 0 additions & 10 deletions packages/math-input/src/components/keypad/shared-keys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ type Props = {
cursorContext?: (typeof CursorContext)[keyof typeof CursorContext];
convertDotToTimes?: boolean;
divisionKey?: boolean;
scientific?: boolean;
};

export default function SharedKeys(props: Props) {
Expand All @@ -26,7 +25,6 @@ export default function SharedKeys(props: Props) {
divisionKey,
convertDotToTimes,
selectedPage,
scientific,
} = props;
const {strings, locale} = useMathInputI18n();
const cursorKeyConfig = getCursorContextConfig(strings, cursorContext);
Expand Down Expand Up @@ -58,14 +56,6 @@ export default function SharedKeys(props: Props) {
coord={[5, 0]}
secondary
/>
{scientific && (
<KeypadButton
keyConfig={Keys.EXP}
onClickKey={onClickKey}
coord={[3, 2]}
secondary
/>
)}
{/* Row 2 */}
<KeypadButton
keyConfig={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const meta: Meta = {
logarithms: true,
preAlgebra: true,
trigonometry: true,
scientific: true,
},
convertDotToTimes: false,
value: "",
Expand Down

0 comments on commit c733c2f

Please sign in to comment.