Skip to content

Commit

Permalink
Hide the flipbook instructions when data is pasted (#1072)
Browse files Browse the repository at this point in the history
## Summary:
Previously, the instructions took up a bunch of screen real estate by
default. Once someone has entered data in the flipbook, the instructions
have served their purpose and can go away.

I've also moved the instructions below the text input so the layout
doesn't shift when the instructions disappear.

Issue: none

Test plan:

```
yarn dev
open http://localhost:5173/#flipbook
```

Follow the instructions onscreen to get some data in the box. The
instructions should vanish. Delete everything from the box and the
instructions should reappear.

Author: benchristel

Reviewers: jeremywiebe, mark-fitzgerald, nedredmond, nishasy

Required Reviewers:

Approved By: jeremywiebe

Checks: ✅ codecov/project, ✅ codecov/patch, ✅ Upload Coverage, ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Extract i18n strings (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Jest Coverage (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ gerald

Pull Request URL: #1072
  • Loading branch information
benchristel authored Mar 13, 2024
1 parent eb637b3 commit e3b4b95
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions dev/flipbook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,10 @@ export function Flipbook() {

const question = selectCurrentQuestion(state);

const noTextEntered = state.questions.trim() === "";

return (
<View style={{padding: Spacing.medium_16}}>
<details open>
<summary>Instructions (click to show/hide)</summary>
<ol>
<li>
<p>
Run a command like one of the following to copy
question data to your clipboard.
</p>
<code>
<pre>{exampleCommands}</pre>
</code>
</li>
<li>
<p>Paste the data in the box below.</p>
</li>
</ol>
</details>

<textarea
wrap={"off"}
rows={10}
Expand All @@ -78,6 +62,23 @@ export function Flipbook() {
Next
</Button>
</View>
<div style={{display: noTextEntered ? "block" : "none"}}>
<h2>Instructions</h2>
<ol>
<li>
<p>
Run a command like one of the following to copy
question data to your clipboard.
</p>
<code>
<pre>{exampleCommands}</pre>
</code>
</li>
<li>
<p>Paste the data in the box above.</p>
</li>
</ol>
</div>
{question != null && (
<SideBySideQuestionRenderer question={question} />
)}
Expand Down

0 comments on commit e3b4b95

Please sign in to comment.