Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

add grow and shrink props to Flex and set minWidth and minHeight by default to 0

Oleg Isonend961c4fa9d01
diff --git a/apps/designer/app/designer/features/inspector/inspector.tsx b/apps/designer/app/designer/features/inspector/inspector.tsx
index 214026d12d..11bbb00d07 100644
--- a/apps/designer/app/designer/features/inspector/inspector.tsx
+++ b/apps/designer/app/designer/features/inspector/inspector.tsx
@@ -8,6 +8,7 @@ import {
Card,
Paragraph,
Box,
+ Flex,
} from "@webstudio-is/design-system";
import { StylePanel } from "~/designer/features/style-panel";
import { PropsPanel } from "~/designer/features/props-panel";
@@ -42,14 +43,7 @@ export const Inspector = ({ publish }: InspectorProps) => {
return (
<FloatingPanelProvider container={tabsRef}>
- <Tabs
- defaultValue="style"
- ref={tabsRef}
- css={{
- // minHeight is required to get flex item height apply to this container
- minHeight: 1,
- }}
- >
+ <Flex as={Tabs} defaultValue="style" ref={tabsRef}>
<TabsList>
<TabsTrigger value="style">
<Text>Style</Text>
@@ -75,7 +69,7 @@ export const Inspector = ({ publish }: InspectorProps) => {
selectedInstanceData={selectedInstanceData}
/>
</TabsContent>
- </Tabs>
+ </Flex>
</FloatingPanelProvider>
);
};
diff --git a/apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx b/apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx
index 85f8018510..97ba7c9e77 100644
--- a/apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx
+++ b/apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx
@@ -45,7 +45,7 @@ export const SidebarLeft = ({ publish }: SidebarLeftProps) => {
);
return (
- <Flex css={{ flexGrow: 1 }}>
+ <Flex grow>
<SidebarTabs activationMode="manual" value={activeTab}>
<SidebarTabsList>
{enabledPanels.map((tabName: TabName) => (
diff --git a/apps/designer/app/designer/shared/assets/assets-shell.tsx b/apps/designer/app/designer/shared/assets/assets-shell.tsx
index 8f073b2410..45686c2930 100644
--- a/apps/designer/app/designer/shared/assets/assets-shell.tsx
+++ b/apps/designer/app/designer/shared/assets/assets-shell.tsx
@@ -30,6 +30,7 @@ export const AssetsShell = ({
css={{ py: "$spacing$5", px: "$spacing$9" }}
gap="2"
direction="column"
+ shrink={false}
>
<AssetUpload type={type} />
<SearchField {...searchProps} autoFocus placeholder="Search" />
diff --git a/packages/design-system/src/components/flex.tsx b/packages/design-system/src/components/flex.tsx
index f6462b96ad..b5de23bdf9 100644
--- a/packages/design-system/src/components/flex.tsx
+++ b/packages/design-system/src/components/flex.tsx
@@ -3,7 +3,9 @@ import { styled } from "../stitches.config";
export const Flex = styled("div", {
boxSizing: "border-box",
display: "flex",
-
+ // Fixes a bug where container doesn't want to grow.
+ minHeight: 0,
+ minWidth: 0,
variants: {
direction: {
row: {
@@ -90,6 +92,22 @@ export const Flex = styled("div", {
gap: "$spacing$20",
},
},
+ shrink: {
+ true: {
+ flexShrink: 1,
+ },
+ false: {
+ flexShrink: 0,
+ },
+ },
+ grow: {
+ true: {
+ flexGrow: 1,
+ },
+ false: {
+ flexGrow: 0,
+ },
+ },
},
defaultVariants: {
direction: "row",