+ {/* Input Card */}
+
+
+ Type a Binary Number
+
+
+
+ Binary:
+
+ handleInputChange(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") convert();
+ }}
+ className="w-44 rounded-lg border-2 border-unit-6 bg-surface px-3 py-2 text-center font-mono text-2xl font-bold tracking-[0.3em] text-unit-6 outline-none focus:border-unit-6-dark"
+ aria-label="Binary number input"
+ />
+ convert()}
+ className="rounded-lg bg-unit-6 px-5 py-2.5 text-sm font-bold text-white transition-colors hover:bg-unit-6-dark"
+ >
+ Convert
+
+
+ Clear
+
+
+ Random
+
+
+
+
+ {PRESETS.map((p) => (
+ applyPreset(p)}
+ className="rounded-lg border-2 border-unit-6/30 bg-unit-6-light px-3 py-1 font-mono text-sm font-bold tracking-widest text-unit-6-dark transition-colors hover:border-unit-6 hover:bg-unit-6 hover:text-white"
+ >
+ {p}
+
+ ))}
+
+
+ {error && (
+
+ {error}
+
+ )}
+
+
+ {/* Place value chart */}
+
+
+
+ Place Value Chart (powers of 2)
+
+
setChartHidden((v) => !v)}
+ className="rounded-md border border-border bg-surface px-2.5 py-1 text-xs font-semibold text-muted transition-colors hover:border-unit-6/50 hover:text-unit-6"
+ >
+ {chartHidden ? "Show Chart" : "Hide Chart"}
+
+
+
+ {!chartHidden && (
+
+
+
+
+ {columns.map((c) => (
+
+ 2{c.exponent}
+
+ ))}
+
+
+ {columns.map((c) => (
+
+ {c.placeValue}
+
+ ))}
+
+
+ {columns.map((c, i) => (
+
+ {c.digit}
+
+ ))}
+
+
+ {columns.map((c, i) => (
+
+ {submitted ? c.contrib : "_"}
+
+ ))}
+
+
+
+
+ )}
+
+ {submitted && (
+
+
{fullExpansion}
+
= {onesOnly}
+
+ )}
+
+
+ {/* Answer banner */}
+
+ {!submitted ? (
+
+ Type a binary number above and press Convert.
+
+ ) : answerHidden ? (
+
+ {submitted}2 = ? (press Show Answer)
+
+ ) : (
+
+ {submitted}2 = {total} in denary
+
+ )}
+ setAnswerHidden((v) => !v)}
+ className="mt-1 rounded-md border border-border bg-surface px-3 py-1 text-xs font-semibold text-muted transition-colors hover:border-unit-6/50 hover:text-unit-6"
+ >
+ {answerHidden ? "Show Answer" : "Hide Answer"}
+
+
+
+ {/* Footer note */}
+
+
+ For students: solve on paper first using the chart in your worksheet. Type the binary number here only to check . The lesson is in the chart, not the click.
+
+
+
+ );
+}
diff --git a/components/layout/mobile-nav.tsx b/components/layout/mobile-nav.tsx
index d52854d..0073619 100644
--- a/components/layout/mobile-nav.tsx
+++ b/components/layout/mobile-nav.tsx
@@ -12,6 +12,7 @@ const unitColorMap = {
"unit-3": "text-unit-3-dark",
"unit-4": "text-unit-4-dark",
"unit-5": "text-unit-5-dark",
+ "unit-6": "text-unit-6-dark",
};
const unitDotColor = {
@@ -20,6 +21,7 @@ const unitDotColor = {
"unit-3": "bg-unit-3",
"unit-4": "bg-unit-4",
"unit-5": "bg-unit-5",
+ "unit-6": "bg-unit-6",
};
export function MobileNav() {
diff --git a/components/layout/sidebar.tsx b/components/layout/sidebar.tsx
index 5d5c49b..a319e76 100644
--- a/components/layout/sidebar.tsx
+++ b/components/layout/sidebar.tsx
@@ -37,6 +37,12 @@ const unitColorMap = {
heading: "text-unit-5-dark",
hoverBg: "hover:bg-unit-5-light/50",
},
+ "unit-6": {
+ active: "bg-unit-6-light text-unit-6-dark border-unit-6/20",
+ dot: "bg-unit-6",
+ heading: "text-unit-6-dark",
+ hoverBg: "hover:bg-unit-6-light/50",
+ },
};
export function Sidebar() {
diff --git a/components/ui/badge.tsx b/components/ui/badge.tsx
index a88ec0c..f4152c4 100644
--- a/components/ui/badge.tsx
+++ b/components/ui/badge.tsx
@@ -1,7 +1,7 @@
import { cn } from "@/lib/utils";
import { type HTMLAttributes } from "react";
-type BadgeVariant = "default" | "unit-1" | "unit-2" | "unit-3" | "unit-4" | "unit-5";
+type BadgeVariant = "default" | "unit-1" | "unit-2" | "unit-3" | "unit-4" | "unit-5" | "unit-6";
interface BadgeProps extends HTMLAttributes