diff --git a/package.json b/package.json index 1112f48..da00345 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bbodek-ui", - "version": "0.0.225", + "version": "0.0.226", "type": "module", "author": "Bbodek", "license": "MIT", diff --git a/src/core/components/Modal/ModalPopUp/index.tsx b/src/core/components/Modal/ModalPopUp/index.tsx index e1813b9..0a91c23 100644 --- a/src/core/components/Modal/ModalPopUp/index.tsx +++ b/src/core/components/Modal/ModalPopUp/index.tsx @@ -11,7 +11,9 @@ const ModalPopUp = forwardRef(( { isOpen, children, + rounded, hasRounded = true, + hasShadow = true, ...props }: PropsWithChildren, ref: React.Ref, @@ -31,8 +33,9 @@ const ModalPopUp = forwardRef((
{children}
diff --git a/src/core/components/Modal/ModalPopUp/types/index.ts b/src/core/components/Modal/ModalPopUp/types/index.ts index 8956d02..9d88bf5 100644 --- a/src/core/components/Modal/ModalPopUp/types/index.ts +++ b/src/core/components/Modal/ModalPopUp/types/index.ts @@ -3,4 +3,4 @@ import { HTMLAttributes } from "react"; import { SectionProps } from "@/core/components/Section/types"; import { ModalBaseProps } from "../../ModalBase/types"; -export interface ModalPopUpProps extends Pick, "hasRounded">, Pick, HTMLAttributes {} +export interface ModalPopUpProps extends Pick, "hasRounded" | "hasShadow" | "rounded">, Pick, HTMLAttributes {} diff --git a/src/core/components/Section/constants/index.ts b/src/core/components/Section/constants/index.ts new file mode 100644 index 0000000..ae80508 --- /dev/null +++ b/src/core/components/Section/constants/index.ts @@ -0,0 +1,17 @@ +import { RoundedType } from "../types"; + +export const ROUNDED = { + ROUNDED_FULL: "rounded-full", + ROUNDED_20: "rounded-20", + ROUNDED_12: "rounded-12", + ROUNDED_6: "rounded-6", + ROUNDED_2: "rounded-2", +} as const; + +export const SECTION_ROUNDED: Record = { + [ROUNDED["ROUNDED_FULL"]]: "rounded-full", + [ROUNDED["ROUNDED_20"]]: "rounded-[1.25rem]", + [ROUNDED["ROUNDED_12"]]: "rounded-xl", + [ROUNDED["ROUNDED_6"]]: "rounded-md", + [ROUNDED["ROUNDED_2"]]: "rounded-sm", +}; diff --git a/src/core/components/Section/index.tsx b/src/core/components/Section/index.tsx index 88ab509..bfe1b45 100644 --- a/src/core/components/Section/index.tsx +++ b/src/core/components/Section/index.tsx @@ -1,12 +1,14 @@ import clsx from "clsx"; import React, { PropsWithChildren, forwardRef } from "react"; +import { ROUNDED, SECTION_ROUNDED } from "./constants"; import { SectionProps } from "./types"; const Section = forwardRef( ( { children, + rounded = ROUNDED["ROUNDED_20"], hasRounded = true, hasBorder = false, hasShadow = false, @@ -24,7 +26,7 @@ const Section = forwardRef( className = { clsx( "bg-white", - hasRounded && "rounded-[1.25rem]", + hasRounded && SECTION_ROUNDED[rounded], hasBorder && "border border-gray-02", hasShadow && "shadow-section", className, diff --git a/src/core/components/Section/types/index.ts b/src/core/components/Section/types/index.ts index ab7ce55..f55072d 100644 --- a/src/core/components/Section/types/index.ts +++ b/src/core/components/Section/types/index.ts @@ -1,6 +1,11 @@ +import { ROUNDED } from "../constants"; + export interface SectionProps extends React.HTMLAttributes { + rounded?: RoundedType; hasRounded?: boolean; hasBorder?: boolean; hasShadow?: boolean; element?: T; } + +export type RoundedType = typeof ROUNDED[keyof typeof ROUNDED];