diff --git a/src/components/ec-container/__snapshots__/ec-container.spec.ts.snap b/src/components/ec-container/__snapshots__/ec-container.spec.ts.snap
index 4af75c78f..14faf3213 100644
--- a/src/components/ec-container/__snapshots__/ec-container.spec.ts.snap
+++ b/src/components/ec-container/__snapshots__/ec-container.spec.ts.snap
@@ -1,5 +1,27 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
+exports[`EcContainer > should apply mobile layout styles when isResponsive is given 1`] = `
+
+`;
+
exports[`EcContainer > should make the navigation collapsable when isCollapsable is given 1`] = `
should not have a collapsable navigation by default 1`] =
`;
+exports[`EcContainer > should not use mobile layout by default 1`] = `
+
+`;
+
exports[`EcContainer > should render empty if no slots were given 1`] = `
{
expect(wrapper.findByDataTest('ec-container__navigation').classes('ec-container__navigation--is-collapsable')).toBe(true);
});
+ it('should not use mobile layout by default', () => {
+ const wrapper = mountEcContainer();
+
+ expect(wrapper.element).toMatchSnapshot();
+ expect(wrapper.findByDataTest('ec-container').classes('ec-container--is-responsive')).toBe(false);
+ expect(wrapper.findByDataTest('ec-container__navigation').classes('ec-container__navigation--is-responsive')).toBe(false);
+ });
+
+ it('should apply mobile layout styles when isResponsive is given', () => {
+ const wrapper = mountEcContainer({ isResponsive: true });
+
+ expect(wrapper.element).toMatchSnapshot();
+ expect(wrapper.findByDataTest('ec-container').classes('ec-container--is-responsive')).toBe(true);
+ expect(wrapper.findByDataTest('ec-container__navigation').classes('ec-container__navigation--is-responsive')).toBe(true);
+ });
+
it('should render empty if no slots were given', () => {
const wrapper = mountEcContainer();
diff --git a/src/components/ec-container/ec-container.story.ts b/src/components/ec-container/ec-container.story.ts
index 5a61b5536..555328a23 100644
--- a/src/components/ec-container/ec-container.story.ts
+++ b/src/components/ec-container/ec-container.story.ts
@@ -210,3 +210,25 @@ withNavigation.args = {
copyrightText: 'Copyright text 2019',
isCollapsed: false,
};
+
+export const withResponsiveLayout: StoryFn
= args => ({
+ components: { EcContainer },
+ setup() {
+ return { args };
+ },
+ template: `
+
+
+ Navigation panel
+
+
+ Main content panel
+
+
+ `,
+});
+
+withResponsiveLayout.args = {
+ isCollapsable: false,
+ isResponsive: true,
+};
diff --git a/src/components/ec-container/ec-container.vue b/src/components/ec-container/ec-container.vue
index 7fd5a1d1f..13e96f6da 100644
--- a/src/components/ec-container/ec-container.vue
+++ b/src/components/ec-container/ec-container.vue
@@ -1,11 +1,15 @@
@@ -30,12 +34,20 @@ defineProps();
@apply tw-flex tw-flex-row tw-items-stretch;
@apply tw-min-h-screen;
+ &--is-responsive {
+ @apply tw-flex-col;
+ }
+
&__navigation {
flex-basis: 280px;
&--is-collapsable {
flex-basis: 80px;
}
+
+ &--is-responsive {
+ @apply tw-basis-auto;
+ }
}
&__content {
diff --git a/src/components/ec-container/types.ts b/src/components/ec-container/types.ts
index 05feb1cd1..0efaed570 100644
--- a/src/components/ec-container/types.ts
+++ b/src/components/ec-container/types.ts
@@ -1,3 +1,4 @@
export interface ContainerProps {
isCollapsable?: boolean,
+ isResponsive?: boolean,
}