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.

1005 B
Raw Blame
import type { ComponentProps } from "react";
import { Flex, cssVar, theme } from "@webstudio-is/design-system";

export const Header = ({
  variant,
  ...props
}: { variant: "aside" | "main" } & ComponentProps<typeof Flex>) => {
  return (
    <Flex
      as="header"
      align="center"
      justify="between"
      shrink={false}
      css={{
        paddingInline:
          variant === "aside" ? theme.spacing[5] : theme.spacing[13],
        height: theme.spacing[19],
        position: "sticky",
        top: 0,
        background: cssVar("--background-primary"),
        zIndex: 1,
      }}
      {...props}
    />
  );
};

export const Main = (props: ComponentProps<typeof Flex>) => {
  return (
    <Flex
      direction="column"
      as="main"
      grow
      css={{
        // Allows scrolling most parent container while header stays sticky
        overflow: "auto",
        // Keeps dialogs on top of the main content
        isolation: "isolate",
      }}
      {...props}
    />
  );
};