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

[WIP] Use extra React state to track temporary Zarr URL #48

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 10 additions & 4 deletions src/scene.tsx
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ export default function Scene(props: SceneProps) {

const [trackManager, setTrackManager] = useState<TrackManager>();
const [dataUrl, setDataUrl] = useState(DEFAULT_ZARR_URL);
const [tempDataUrl, setTempDataUrl] = useState(DEFAULT_ZARR_URL.toString());
const [numTimes, setNumTimes] = useState(0);
const [curTime, setCurTime] = useState(0);
const [autoRotate, setAutoRotate] = useState(false);
@@ -171,10 +172,15 @@ export default function Scene(props: SceneProps) {
<div className="inputcontainer">
<InputText
id="url-input"
label="Zarr URL"
placeholder={DEFAULT_ZARR_URL.toString()}
value={dataUrl.toString()}
onChange={(e) => setDataUrl(new URL(e.target.value))}
label="Zarr group track data URL"
hideLabel={true}
placeholder="Zarr group track data URL"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We probably shouldn't have a visible label and a placeholder unless they contain different information. I slightly prefer the placeholder because it saves space, but no strong preference.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if there is a design principle we can refer to here. The name "placeholder" to me implies it should be some example text, rather than a label or instruction. Otherwise I agree I would lean toward using the placeholder and removing the label to save space.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can't find any recommendations from Material: https://m3.material.io/components/text-fields/overview

Looks like the placeholder isn't recommended there - instead a label underneath should be used to explain what this is.

I've seen a placeholder used for instructions or for an example.

I'll just leave it alone in this PR though and we can poke design later to see what their recommendations area.

value={tempDataUrl}
onChange={(e) => setTempDataUrl(e.target.value)}
onKeyUp={(e) => {
if (e.key === "Enter") setDataUrl(new URL(tempDataUrl));
}}
onBlur={() => setDataUrl(new URL(tempDataUrl))}
fullWidth={true}
intent={trackManager ? "default" : "error"}
/>