From 038a1c972b142af1ed13618f7da96be63050cdb9 Mon Sep 17 00:00:00 2001 From: Abel Lopes Date: Thu, 2 Nov 2023 23:26:07 +0000 Subject: [PATCH] refactor: simplify variation & spacing declaration --- packages/components/all/src/container/index.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/components/all/src/container/index.tsx b/packages/components/all/src/container/index.tsx index b7148c23..6be7f8a5 100644 --- a/packages/components/all/src/container/index.tsx +++ b/packages/components/all/src/container/index.tsx @@ -2,25 +2,31 @@ import React from "react"; import styles from "./index.module.scss"; import classNames from "classnames"; -type ContainerVariation = "horizontal" | "vertical" | "small"; +type ContainerVariation = "small"; -interface ContainerProps extends React.HTMLAttributes { +export interface ContainerProps extends React.HTMLAttributes { variation?: ContainerVariation | ContainerVariation[]; + spacingX?: boolean; + spacingY?: boolean; } export const Container = ({ - variation = "horizontal", + variation, + spacingX = true, + spacingY, className, ...otherProps }: Readonly): React.ReactElement => { - const computedVariations = Array.isArray(variation) ? variation : [variation]; + const computedVariations = + Array.isArray(variation) || variation === undefined ? variation : [variation]; return (
styles[i]), className, - computedVariations.map((i) => styles[i]), )} {...otherProps} />