Ghost/ghost/admin/app/templates/settings/design/index.hbs
Kevin Ansfield 019b22caa1 Added desktop/mobile switch to <GhBrowserPreview> component
refs https://github.com/TryGhost/Team/issues/1310

- we had a `<GhBrowserPreview>` component but it wasn't being used everywhere because it's behaviour didn't match the mobile/desktop switch with no iframe re-render that we needed for some screens
- updated component to match all required behaviour
  - include a switch between desktop and mobile views
  - default fallbacks for `@title` and `@icon` arguments
- switched design settings themes over to using the component instead of repeating the same set of markup
2022-02-04 10:28:20 +00:00

41 lines
2.0 KiB
Handlebars

<section class="gh-canvas gh-design" {{on-key "cmd+s" this.saveFromKeyboard}}>
<GhCanvasHeader class="gh-canvas-header">
<h2 class="gh-canvas-title">Site design</h2>
<section class="view-actions">
<div class="gh-select gh-design-page-preview-mode">
<OneWaySelect
@value={{this.themeManagement.previewType}}
@options={{this.themeManagement.availablePreviewTypes}}
@optionValuePath="name"
@optionLabelPath="label"
@optionTargetPath="name"
@update={{this.themeManagement.setPreviewType}}
/>
{{svg-jar "arrow-down-small"}}
</div>
<div class="gh-contentfilter gh-btn-group">
<button type="button" class="gh-btn gh-design-preview-mode {{if this.isDesktopPreview "gh-btn-group-selected"}}" {{on "click" (fn this.setPreviewSize "desktop")}} data-test-button="desktop-preview"><span>{{svg-jar "desktop"}}</span></button>
<button type="button" class="gh-btn gh-design-preview-mode {{if this.isMobilePreview "gh-btn-group-selected"}}" {{on "click" (fn this.setPreviewSize "mobile")}} data-test-button="mobile-preview"><span>{{svg-jar "mobile-phone"}}</span></button>
</div>
<GhTaskButton
@buttonText="Save changes"
@task={{this.saveTask}}
@successText="Saved"
@runningText="Saving"
@class="gh-btn gh-btn-primary gh-btn-icon"
data-test-button="save-settings"
/>
</section>
</GhCanvasHeader>
<div class="view-container">
<GhBrowserPreview @isMobilePreview={{this.isMobilePreview}}>
<GhHtmlIframe
class={{if this.isMobilePreview "gh-post-preview-iframe" "site-frame"}}
@html={{this.themeManagement.previewHtml}}
@pageId={{this.themeManagement.previewType}} />
</GhBrowserPreview>
</div>
</section>