2020-01-16 18:14:03 +03:00
|
|
|
<LiquidWormhole @class="unsplash">
|
2018-08-09 16:15:47 +03:00
|
|
|
{{!-- TODO: why does this modal background not cover the PSM without style override? --}}
|
|
|
|
<div class="fullscreen-modal-background" {{action "close"}} style="z-index: 999"></div>
|
|
|
|
<div class="absolute top-8 right-8 bottom-8 left-8 br4 overflow-hidden bg-white z-9999" data-unsplash>
|
|
|
|
{{!-- close button --}}
|
|
|
|
<button type="button" class="absolute top-6 right-6" {{action "close"}}>
|
|
|
|
{{svg-jar "close" class="w4 stroke-midlightgrey-l2"}}
|
|
|
|
</button>
|
2017-08-02 10:05:59 +03:00
|
|
|
|
2018-08-09 16:15:47 +03:00
|
|
|
<div class="flex flex-column h-100">
|
|
|
|
{{!-- static header --}}
|
|
|
|
<header class="flex-shrink-0 flex flex-row-l flex-column justify-between pt6 pr8 pb6 pl8 pt10-l pr20-l pb10-l pl20-l items-center">
|
|
|
|
<h1 class="flex items-center darkgrey-d2 w-100 nudge-top--4">
|
|
|
|
<a class="dib w8 mr2" href="https://unsplash.com/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit" target="_blank">{{svg-jar "unsplash" class="fill-darkgrey-d2"}}</a>
|
|
|
|
Unsplash
|
|
|
|
</h1>
|
|
|
|
<span class="gh-input-icon mw88-l flex-auto w-100 mt3 mt0-l">
|
|
|
|
{{svg-jar "search"}}
|
2020-01-16 18:14:03 +03:00
|
|
|
<GhTextInput
|
|
|
|
@class="gh-unsplash-search"
|
|
|
|
@name="searchKeyword"
|
|
|
|
@placeholder="Search free high-resolution photos"
|
|
|
|
@tabindex="1"
|
|
|
|
@shouldFocus={{true}}
|
|
|
|
@autocorrect="off"
|
|
|
|
@value={{readonly this.unsplash.searchTerm}}
|
|
|
|
@input={{action "search" value="target.value"}}
|
|
|
|
@focusIn={{action "setKeyScope"}}
|
|
|
|
@focus-out={{action "resetKeyScope"}}
|
|
|
|
/>
|
2018-08-09 16:15:47 +03:00
|
|
|
</span>
|
|
|
|
</header>
|
2017-08-02 10:05:59 +03:00
|
|
|
|
2018-08-09 16:15:47 +03:00
|
|
|
{{!-- content container --}}
|
|
|
|
<div class="relative h-100 overflow-hidden">
|
|
|
|
{{!-- scrollable image container --}}
|
|
|
|
<div class="overflow-auto h-100 w-100 pr8 pl8 pr20-l pl20-l">
|
2019-12-13 17:20:29 +03:00
|
|
|
{{#if this.unsplash.photos}}
|
2018-08-09 16:15:47 +03:00
|
|
|
<section class="gh-unsplash-grid">
|
2019-12-13 17:20:29 +03:00
|
|
|
{{#each this.unsplash.columns as |photos|}}
|
2018-08-09 16:15:47 +03:00
|
|
|
<div class="gh-unsplash-grid-column">
|
|
|
|
{{#each photos as |photo|}}
|
2020-01-16 18:14:03 +03:00
|
|
|
<GhUnsplashPhoto @photo={{photo}} @zoom={{action "zoomPhoto"}} @select={{action "select"}} />
|
2018-08-09 16:15:47 +03:00
|
|
|
{{/each}}
|
|
|
|
</div>
|
|
|
|
{{/each}}
|
|
|
|
</section>
|
2019-12-13 17:20:29 +03:00
|
|
|
{{else if (and this.unsplash.searchTerm (not this.unsplash.error this.unsplash.isLoading))}}
|
2018-08-15 17:36:24 +03:00
|
|
|
<section class="gh-unsplash-error h-100 flex items-center justify-center pb30">
|
|
|
|
<div>
|
|
|
|
<img class="gh-unsplash-error-404" src="assets/img/unsplash-404.png" alt="No photos found" />
|
2019-12-13 17:20:29 +03:00
|
|
|
<h4>No photos found for '{{this.unsplash.searchTerm}}'</h4>
|
2018-08-15 17:36:24 +03:00
|
|
|
</div>
|
2018-08-09 16:15:47 +03:00
|
|
|
</section>
|
|
|
|
{{/if}}
|
|
|
|
|
2019-12-13 17:20:29 +03:00
|
|
|
{{#if this.unsplash.error}}
|
2018-08-09 16:15:47 +03:00
|
|
|
{{!-- TODO: add better error styles? --}}
|
2018-08-15 17:36:24 +03:00
|
|
|
<section class="gh-unsplash-error h-100 flex items-center justify-center pb30">
|
|
|
|
<div>
|
|
|
|
<img class="gh-unsplash-error-404" src="assets/img/unsplash-404.png" alt="Network error" />
|
2019-12-13 17:20:29 +03:00
|
|
|
<h4>{{this.unsplash.error}} (<a href="#" {{action "retry"}}>retry</a>)</h4>
|
2018-08-15 17:36:24 +03:00
|
|
|
</div>
|
2018-08-09 16:15:47 +03:00
|
|
|
</section>
|
|
|
|
{{/if}}
|
|
|
|
|
2019-12-13 17:20:29 +03:00
|
|
|
{{#if this.unsplash.isLoading}}
|
2018-08-15 17:36:24 +03:00
|
|
|
<div class="gh-unsplash-loading h-100 flex items-center justify-center pb30">
|
2018-08-09 16:15:47 +03:00
|
|
|
<div class="gh-loading-spinner"></div>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
2017-08-02 10:05:59 +03:00
|
|
|
|
2020-01-16 18:14:03 +03:00
|
|
|
<GhScrollTrigger
|
|
|
|
@enter={{action "loadNextPage"}}
|
|
|
|
@triggerOffset={{1000}} />
|
2018-08-09 16:15:47 +03:00
|
|
|
</div>
|
|
|
|
|
|
|
|
{{!-- zoomed image overlay --}}
|
2019-12-13 17:20:29 +03:00
|
|
|
{{#if this.zoomedPhoto}}
|
2018-08-09 16:15:47 +03:00
|
|
|
<div class="absolute flex justify-center top-0 right-0 bottom-0 left-0 pr20 pb10 pl20 bg-white overflow-hidden" {{action "closeZoom"}}>
|
2020-01-16 18:14:03 +03:00
|
|
|
<GhUnsplashPhoto
|
|
|
|
@photo={{this.zoomedPhoto}}
|
|
|
|
@zoomed={{true}}
|
|
|
|
@zoom={{action "closeZoom"}}
|
|
|
|
@select={{action "select"}} />
|
2017-08-02 10:05:59 +03:00
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-01-16 18:14:03 +03:00
|
|
|
</LiquidWormhole>
|