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/ComponentsDocumentation/components/Topbar/index.js b/src/App/ComponentsDocumentation/components/Topbar/index.js
index 9c0311b703..93b17934c5 100644
--- a/src/App/ComponentsDocumentation/components/Topbar/index.js
+++ b/src/App/ComponentsDocumentation/components/Topbar/index.js
@@ -44,6 +44,7 @@ const Overview = () => (
showCasePanel
codeFigure
showCasePanelAdvanced={topbarShowcase}
+ showExpandPreview={true}
/>
When to consider something else
diff --git a/src/App/docutils/ComponentPreview/index.js b/src/App/docutils/ComponentPreview/index.js
index 59ddd20996..3eafb06f0f 100644
--- a/src/App/docutils/ComponentPreview/index.js
+++ b/src/App/docutils/ComponentPreview/index.js
@@ -19,6 +19,7 @@ const ComponentPreview = ({
codeFigure,
dangerousHTML,
negative,
+ showExpandPreview = false,
}) => {
const _removeOuterTag = (element) => {
const div = document.createElement("div");
@@ -214,6 +215,7 @@ const ComponentPreview = ({
.activeOptions
? [...this.props.showCasePanelAdvanced.elements[0].activeOptions]
: [],
+ previewExpanded: false,
};
}
@@ -351,6 +353,13 @@ const ComponentPreview = ({
}
}
+ setExpandedPreview(state) {
+ this.setState({ previewExpanded: state });
+ state
+ ? document.body.classList.add("has-vscroll")
+ : document.body.classList.remove("has-vscroll");
+ }
+
render() {
return (
<>
@@ -358,13 +367,44 @@ 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" : ""}`}
>
+ {this.props.showExpandPreview &&
+ (!this.state.previewExpanded ? (
+
+ ) : (
+
+ ))}
{this.props.showCasePanelAdvanced.elements.map((element, i) => (
) : (
@@ -608,6 +649,7 @@ ComponentPreview.propTypes = {
codeFigure: PropTypes.bool,
dangerousHTML: PropTypes.bool,
negative: PropTypes.bool,
+ showExpandPreview: PropTypes.bool,
};
export default ComponentPreview;
diff --git a/src/less/documentation-swedbankpay.less b/src/less/documentation-swedbankpay.less
index 85a3b0240e..8fe7623cab 100644
--- a/src/less/documentation-swedbankpay.less
+++ b/src/less/documentation-swedbankpay.less
@@ -2,6 +2,8 @@
@import "global.less";
#designguide {
+ --fullscreen-z-index: 10000;
+
display: flex;
flex-direction: column;
min-height: 100%;
@@ -947,6 +949,13 @@
border-color: transparent;
}
}
+
+ > button[aria-label^="Expand"],
+ > button[aria-label^="Zoom"] {
+ width: 30px;
+ height: 30px;
+ margin: 4px;
+ }
}
.options-open {
@@ -1074,6 +1083,16 @@
}
}
}
+
+ &.preview-expanded {
+ position: fixed;
+ width: 100vw;
+ left: 0;
+ z-index: var(--fullscreen-z-index, 10000);
+ top: 0;
+ height: 100vh;
+ margin: 0;
+ }
}
.icon-preview {