Skip to content

Commit

Permalink
Merge pull request desmosinc#18 from colebillys19/rithm-mute-preview
Browse files Browse the repository at this point in the history
Mute preview tool when there are no frames in state
  • Loading branch information
misscoded authored Jun 26, 2019
2 parents ecfc5bb + f8a91c1 commit f2b9924
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 53 deletions.
66 changes: 33 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/components/Preview.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
min-height: 100vh;
}

.Preview-muted {
opacity: 0.2;
pointer-events: none;
}

.Preview-scrubber {
text-align: center;
width: 340px;
Expand Down Expand Up @@ -75,3 +80,11 @@
opacity: 1;
}
}

.Preview-no-frames {
width: 360px;
margin: 0 auto;
color: #fff;
text-align: center;
font-weight: bold;
}
48 changes: 28 additions & 20 deletions src/components/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,29 @@ class Preview extends Component {
<h2>Preview</h2>
<InfoIcon infoText={previewText} />
</div>
<Frame
imageSrc={imageSrc}
playing={playing}
togglePlaying={this.handleTogglePlaying}
/>
<div className="Preview-scrubber" data-testid="Preview-scrubber">
<input
type="range"
min="0"
max={numFrames - 1}
value={previewIdx}
onChange={this.handlePreviewUpdate}
disabled={!numFrames}
aria-label="preview frame index"
<div className={classNames({ 'Preview-muted': !numFrames })}>
<Frame
imageSrc={imageSrc}
playing={playing}
togglePlaying={this.handleTogglePlaying}
/>
</div>
<div
className="Preview-scrubber-counter"
data-testid="Preview-scrubber-counter"
>
{numFrames ? `${previewIdx + 1} / ${numFrames}` : '0 / 0'}
<div className="Preview-scrubber" data-testid="Preview-scrubber">
<input
type="range"
min="0"
max={numFrames - 1}
value={previewIdx}
onChange={this.handlePreviewUpdate}
disabled={!numFrames}
aria-label="preview frame index"
/>
</div>
<div
className="Preview-scrubber-counter"
data-testid="Preview-scrubber-counter"
>
{numFrames ? `${previewIdx + 1} / ${numFrames}` : '0 / 0'}
</div>
</div>
<div
className="Preview-create"
Expand All @@ -150,6 +152,12 @@ class Preview extends Component {
{gifProgress === 1 ? (
<div className="Preview-progress-success">Download Successful</div>
) : null}
{!numFrames ? (
<div className="Preview-no-frames">
No frames have been captured. Use the camera or burst tools to add
some!
</div>
) : null}
</div>
);
}
Expand Down

0 comments on commit f2b9924

Please sign in to comment.