Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,23 @@ const App = () => {
<InlineCodeBlock>7. grow="0"</InlineCodeBlock>
</Container>
</Container>

<Text>
Parent Container:
<InlineCodeBlock>
border="default" fillWidth=true padding="md"
</InlineCodeBlock>
</Text>

<Container
border="default"
fillWidth
padding="md"
>
<Container grow="0">
<InlineCodeBlock>7. grow="0"</InlineCodeBlock>
</Container>
</Container>
</Container>

<Spacer />
Expand Down
7 changes: 7 additions & 0 deletions src/components/Container/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { Orientation } from "@/components";

type AlignItemsOptions = "start" | "center" | "end" | "stretch";
type BorderColor = "default" | "intense" | "muted";
export type GapOptions = "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
type GrowShrinkOptions = "0" | "1" | "2" | "3" | "4" | "5" | "6";
type JustifyContentOptions =
Expand All @@ -25,6 +26,7 @@ type WrapOptions = "nowrap" | "wrap" | "wrap-reverse";

export interface ContainerProps<T extends ElementType = "div"> {
component?: T;
border?: BorderColor;
alignItems?: AlignItemsOptions;
children?: React.ReactNode;
fillWidth?: boolean;
Expand All @@ -51,6 +53,7 @@ type ContainerPolymorphicComponent = <T extends ElementType = "div">(
const _Container = <T extends ElementType = "div">(
{
component,
border,
alignItems,
children,
fillWidth = true,
Expand All @@ -77,6 +80,7 @@ const _Container = <T extends ElementType = "div">(
ref={ref}
as={component ?? "div"}
$alignItems={alignItems ?? (orientation === "vertical" ? "start" : "center")}
$border={border}
$fillWidth={fillWidth}
$gapSize={gap}
$grow={grow}
Expand All @@ -101,6 +105,7 @@ const _Container = <T extends ElementType = "div">(
};
const Wrapper = styled.div<{
$alignItems: AlignItemsOptions;
$border?: BorderColor;
$fillWidth?: boolean;
$gapSize: GapOptions;
$grow?: GrowShrinkOptions;
Expand Down Expand Up @@ -130,6 +135,8 @@ const Wrapper = styled.div<{
${({ $overflow }) => `
${$overflow && `overflow: ${$overflow}`};
`}
${({ $border, theme }) =>
$border ? `border: 1px solid ${theme.click.global.color.stroke[$border]};` : ""}
flex-wrap: ${({ $wrap = "nowrap" }) => $wrap};
gap: ${({ theme, $gapSize }) => theme.click.container.gap[$gapSize]};
max-width: ${({ $maxWidth }) => $maxWidth ?? "none"};
Expand Down
Loading