design(preview): replace path input with strict dropdown menu

This commit is contained in:
2026-06-12 12:22:50 -07:00
parent cd26dd807f
commit 2a2962a098

View File

@@ -237,16 +237,6 @@ function PreviewDeviceToggles() {
}} }}
/> />
<span
style={{
opacity: 0.5,
flexShrink: 0,
paddingLeft: 4,
fontFamily: "var(--font-mono), monospace",
}}
>
/
</span>
<div <div
style={{ style={{
flex: 1, flex: 1,
@@ -256,14 +246,9 @@ function PreviewDeviceToggles() {
alignItems: "center", alignItems: "center",
}} }}
> >
<input <select
type="text" value={currentPath}
list="common-routes" onChange={(e) => setCurrentPath(e.target.value)}
value={currentPath === "/" ? "" : currentPath.replace(/^\//, "")}
onChange={(e) =>
setCurrentPath("/" + e.target.value.replace(/^\//, ""))
}
placeholder="path (e.g. dashboard)"
style={{ style={{
background: "transparent", background: "transparent",
border: "none", border: "none",
@@ -274,22 +259,19 @@ function PreviewDeviceToggles() {
textOverflow: "ellipsis", textOverflow: "ellipsis",
fontFamily: "var(--font-mono), monospace", fontFamily: "var(--font-mono), monospace",
paddingRight: 16, paddingRight: 16,
appearance: "none",
cursor: "pointer",
}} }}
onKeyDown={(e) => { >
if (e.key === "Enter") { <option value="/">/</option>
triggerRefresh(); // force reload iframe <option value="/dashboard">/dashboard</option>
} <option value="/login">/login</option>
}} <option value="/signup">/signup</option>
/> <option value="/about">/about</option>
<datalist id="common-routes"> <option value="/contact">/contact</option>
<option value="dashboard" /> <option value="/pricing">/pricing</option>
<option value="login" /> <option value="/settings">/settings</option>
<option value="signup" /> </select>
<option value="about" />
<option value="contact" />
<option value="pricing" />
<option value="settings" />
</datalist>
<ChevronDown <ChevronDown
size={12} size={12}
style={{ style={{