From 21492fb5cfe02a1143f803311f0e43605588f714 Mon Sep 17 00:00:00 2001 From: Raphael Ferrand Date: Thu, 31 Aug 2023 16:21:29 +0200 Subject: [PATCH 1/2] SWED-2268 add expand component preview feature --- RELEASE_NOTES.md | 2 ++ src/App/docutils/ComponentPreview/index.js | 41 +++++++++++++++++++++- src/less/documentation-swedbankpay.less | 12 +++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e16b88789c..6cd7e5b03f 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -15,3 +15,5 @@ - E2E tests for dropdown component ## Design System website + +- expand components preview containers to full screen diff --git a/src/App/docutils/ComponentPreview/index.js b/src/App/docutils/ComponentPreview/index.js index 59ddd20996..c0b655ccfe 100644 --- a/src/App/docutils/ComponentPreview/index.js +++ b/src/App/docutils/ComponentPreview/index.js @@ -214,6 +214,7 @@ const ComponentPreview = ({ .activeOptions ? [...this.props.showCasePanelAdvanced.elements[0].activeOptions] : [], + previewExpanded: false, }; } @@ -351,6 +352,14 @@ const ComponentPreview = ({ } } + setExpandedPreview(state) { + this.setState({ previewExpanded: state }); + + if (state) { + document.body.classList.add("has-vscroll"); + } + } + render() { return ( <> @@ -358,13 +367,43 @@ const ComponentPreview = ({ id={this.props.showCasePanelAdvanced.id} className={`showcase-panel showcase-panel-advanced${ this.state.optionsOpen ? " options-active" : "" - }${this.state.hideOptions ? " hide-options" : ""}`} + }${this.state.hideOptions ? " hide-options" : ""} + ${this.state.previewExpanded ? " preview-expanded" : ""}`} >