diff --git a/blocks/canvas/ew-block-library-modal/ew-block-library-modal.css b/blocks/canvas/ew-block-library-modal/ew-block-library-modal.css index 6d19a56d3..8d01aaa4d 100644 --- a/blocks/canvas/ew-block-library-modal/ew-block-library-modal.css +++ b/blocks/canvas/ew-block-library-modal/ew-block-library-modal.css @@ -3,15 +3,15 @@ } .modal { - --nx-dialog-max-width: 960px; - --nx-dialog-max-height: 640px; + --nx-dialog-max-width: min(1440px, 95vw); + --nx-dialog-max-height: min(900px, 90vh); --nx-dialog-padding: 0; } .modal-content { - width: 960px; + width: var(--nx-dialog-max-width); max-width: 100%; - height: 640px; + height: var(--nx-dialog-max-height); max-height: 100%; display: grid; grid-template-rows: auto 1fr; @@ -208,6 +208,14 @@ background: var(--s2-gray-50); } +.modal-preview-toolbar { + display: flex; + gap: 4px; + padding: var(--s2-spacing-100); + border-bottom: 1px solid var(--s2-gray-200); + background: var(--s2-gray-75); +} + .modal-preview-placeholder { display: flex; align-items: center; @@ -217,6 +225,21 @@ font-size: var(--s2-body-size-s); } +.modal-preview-stage { + flex: 1; + min-height: 0; + display: flex; + justify-content: center; + overflow: auto; +} + +.modal-preview-viewport { + display: flex; + width: 100%; + max-width: 100%; + min-height: 0; +} + .modal-preview-frame { flex: 1; width: 100%; @@ -239,4 +262,3 @@ margin: 0; } - diff --git a/blocks/canvas/ew-block-library-modal/ew-block-library-modal.js b/blocks/canvas/ew-block-library-modal/ew-block-library-modal.js index e8db46054..d51bfc685 100644 --- a/blocks/canvas/ew-block-library-modal/ew-block-library-modal.js +++ b/blocks/canvas/ew-block-library-modal/ew-block-library-modal.js @@ -21,6 +21,12 @@ const SEARCH_ICON_SRC = '/img/icons/s2-icon-search-20-n.svg'; const INFO_ICON_SRC = '/img/icons/s2-icon-infocircle-20-n.svg'; const ADD_ICON_SRC = '/img/icons/s2-icon-addcircle-20-n.svg'; +const VIEWPORTS = [ + ['desktop', 'Desktop', '100%', '/img/icons/s2-icon-devicedesktop-20-n.svg'], + ['tablet', 'Tablet', '768px', '/img/icons/s2-icon-devicetablet-20-n.svg'], + ['mobile', 'Mobile', '390px', '/img/icons/s2-icon-devicephone-20-n.svg'], +]; + function andMatch(query, target) { const terms = query.split(/\s+/).filter(Boolean); return terms.every((term) => target.includes(term)); @@ -50,6 +56,7 @@ class EwBlockLibraryModal extends LitElement { _expandedPath: { state: true }, _selectedPath: { state: true }, _previewInfo: { state: true }, + _viewport: { state: true }, _hashState: { state: true }, _search: { state: true }, _openDescriptions: { state: true }, @@ -60,6 +67,7 @@ class EwBlockLibraryModal extends LitElement { this.shadowRoot.adoptedStyleSheets = [buttonsStyle, formStyle, style]; this._variantsByPath = new Map(); this._openDescriptions = new Set(); + this._viewport = 'desktop'; this._unsubHash = hashChange.subscribe((state) => { this._hashState = state; }); } @@ -271,6 +279,21 @@ class EwBlockLibraryModal extends LitElement { `; } + _renderViewportBar() { + return html` +
`; + } + _renderPreview() { if (!this._previewInfo) { return html`${error}