2017-08-02 10:05:59 +03:00
|
|
|
|
{{#liquid-wormhole class="unsplash"}}
|
|
|
|
|
<div class="gh-unsplash {{if ui.hasSideNav "gh-unsplash--with-sidenav"}}">
|
|
|
|
|
<div class="gh-unsplash-window">
|
|
|
|
|
<div class="gh-unsplash-container">
|
2018-03-19 12:57:31 +03:00
|
|
|
|
<a class="gh-unsplash-logo" href="https://unsplash.com/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit" target="_blank">{{svg-jar "unsplash"}}</a>
|
|
|
|
|
<div class="gh-unsplash-close" aria-role="button" {{action "close"}}>{{svg-jar "close"}}</div>
|
2017-08-02 10:05:59 +03:00
|
|
|
|
<header class="gh-unsplash-header">
|
|
|
|
|
<h1 class="gh-unsplash-header-title">Unsplash</h1>
|
|
|
|
|
<p class="gh-unsplash-header-desc">Beautiful, free photos.<br>
|
|
|
|
|
Gifted by the world’s most generous community of photographers. 🎁</p>
|
|
|
|
|
<span class="gh-input-icon">
|
2018-03-19 12:57:31 +03:00
|
|
|
|
{{svg-jar "search"}}
|
2018-02-28 14:44:03 +03:00
|
|
|
|
{{gh-text-input
|
2017-08-02 10:05:59 +03:00
|
|
|
|
class="gh-unsplash-search"
|
|
|
|
|
name="searchKeyword"
|
|
|
|
|
placeholder="Search free high-resolution photos"
|
|
|
|
|
tabindex="1"
|
2018-06-04 19:46:24 +03:00
|
|
|
|
autofocus="autofocus"
|
2017-08-02 10:05:59 +03:00
|
|
|
|
autocorrect="off"
|
2018-02-28 14:44:03 +03:00
|
|
|
|
value=(readonly unsplash.searchTerm)
|
|
|
|
|
input=(action "updateSearch" target=unsplash value="target.value")
|
2018-01-12 21:09:10 +03:00
|
|
|
|
focusIn=(action "setKeyScope")
|
2018-02-28 14:44:03 +03:00
|
|
|
|
focus-out=(action "resetKeyScope")
|
2017-08-02 10:05:59 +03:00
|
|
|
|
}}
|
|
|
|
|
</span>
|
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
{{#if unsplash.photos}}
|
|
|
|
|
<section class="gh-unsplash-grid">
|
|
|
|
|
{{#each unsplash.columns as |photos|}}
|
|
|
|
|
<div class="gh-unsplash-grid-column">
|
|
|
|
|
{{#each photos as |photo|}}
|
|
|
|
|
{{gh-unsplash-photo photo=photo zoom=(action "zoomPhoto") insert=(action "insert")}}
|
|
|
|
|
{{/each}}
|
|
|
|
|
</div>
|
|
|
|
|
{{/each}}
|
|
|
|
|
</section>
|
|
|
|
|
{{else if (and unsplash.searchTerm (not unsplash.error unsplash.isLoading))}}
|
|
|
|
|
<section class="gh-unsplash-error">
|
|
|
|
|
<img class="gh-unsplash-error-404" src="assets/img/unsplash-404.png" alt="No photos found" />
|
|
|
|
|
<h4>No photos found for '{{unsplash.searchTerm}}'</h4>
|
|
|
|
|
</section>
|
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
|
|
{{#if unsplash.error}}
|
|
|
|
|
{{!-- TODO: add better error styles? --}}
|
|
|
|
|
<section class="gh-unsplash-error">
|
|
|
|
|
<img class="gh-unsplash-error-404" src="assets/img/unsplash-404.png" alt="Network error" />
|
|
|
|
|
<h4>{{unsplash.error}} (<a href="#" {{action "retry"}}>retry</a>)</h4>
|
|
|
|
|
</section>
|
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
|
|
{{#if unsplash.isLoading}}
|
|
|
|
|
<div class="gh-unsplash-loading">
|
|
|
|
|
<div class="gh-loading-spinner"></div>
|
|
|
|
|
</div>
|
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
|
|
{{gh-scroll-trigger
|
2018-04-24 15:10:20 +03:00
|
|
|
|
enter=(action "loadNextPage")
|
2017-08-02 10:05:59 +03:00
|
|
|
|
triggerOffset=1000}}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{{#if zoomedPhoto}}
|
|
|
|
|
<div class="gh-unsplash-zoom" {{action "closeZoom"}}>
|
|
|
|
|
{{gh-unsplash-photo
|
|
|
|
|
photo=zoomedPhoto
|
|
|
|
|
zoomed=true
|
|
|
|
|
zoom=(action "closeZoom")
|
|
|
|
|
insert=(action "insert")}}
|
|
|
|
|
</div>
|
|
|
|
|
{{/if}}
|
|
|
|
|
|
2018-06-04 19:46:24 +03:00
|
|
|
|
{{/liquid-wormhole}}
|