diff --git a/__snapshots__/container--container-row-col-chromium.png b/__snapshots__/container--container-row-col-chromium.png index 85f1e86a..900d2429 100644 Binary files a/__snapshots__/container--container-row-col-chromium.png and b/__snapshots__/container--container-row-col-chromium.png differ diff --git a/__snapshots__/container--container-row-col-firefox.png b/__snapshots__/container--container-row-col-firefox.png index 3e986f61..6946a7b8 100644 Binary files a/__snapshots__/container--container-row-col-firefox.png and b/__snapshots__/container--container-row-col-firefox.png differ diff --git a/__snapshots__/container--container-row-col-webkit.png b/__snapshots__/container--container-row-col-webkit.png index c324e986..6f6b2e65 100644 Binary files a/__snapshots__/container--container-row-col-webkit.png and b/__snapshots__/container--container-row-col-webkit.png differ diff --git a/__snapshots__/quote--quote-sample-chromium.png b/__snapshots__/quote--quote-sample-chromium.png index 3e0c189d..090e454a 100644 Binary files a/__snapshots__/quote--quote-sample-chromium.png and b/__snapshots__/quote--quote-sample-chromium.png differ diff --git a/__snapshots__/quote--quote-sample-firefox.png b/__snapshots__/quote--quote-sample-firefox.png index 1aeb701a..435d070d 100644 Binary files a/__snapshots__/quote--quote-sample-firefox.png and b/__snapshots__/quote--quote-sample-firefox.png differ diff --git a/__snapshots__/quote--quote-sample-webkit.png b/__snapshots__/quote--quote-sample-webkit.png index 1464bd68..53f6115b 100644 Binary files a/__snapshots__/quote--quote-sample-webkit.png and b/__snapshots__/quote--quote-sample-webkit.png differ diff --git a/package-lock.json b/package-lock.json index 246eb442..c7be43bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,8 +7,8 @@ "": { "name": "@code0-tech/pictor", "version": "0.1.0-pre-alpha", - "license": "MIT", "dependencies": { + "merge-props": "^6.0.0", "react-aria": "^3.31.1", "react-stately": "^3.29.1", "rollup-plugin-visualizer": "^5.11.0" @@ -9454,13 +9454,13 @@ } }, "node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dev": true, "dependencies": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -9468,7 +9468,7 @@ "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", - "raw-body": "2.5.1", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, @@ -10361,9 +10361,9 @@ "dev": true }, "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "dev": true, "engines": { "node": ">= 0.6" @@ -11744,17 +11744,17 @@ "dev": true }, "node_modules/express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dev": true, "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -12222,9 +12222,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "dev": true, "funding": [ { @@ -13284,9 +13284,9 @@ } }, "node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", + "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==", "dev": true }, "node_modules/ipaddr.js": { @@ -17110,6 +17110,11 @@ "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", "dev": true }, + "node_modules/merge-props": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/merge-props/-/merge-props-6.0.0.tgz", + "integrity": "sha512-ORZFZMGKE5PuAi7YfVCfPz3jiS9V0t2XXE2AGYiwMrcudRuj0hkXKEzsl17pUF07r+Digf9YlTzteX2LFE6vAQ==" + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -19261,9 +19266,9 @@ } }, "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dev": true, "dependencies": { "bytes": "3.1.2", @@ -21140,9 +21145,9 @@ "dev": true }, "node_modules/tar": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", - "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", "dev": true, "dependencies": { "chownr": "^2.0.0", @@ -21935,9 +21940,9 @@ } }, "node_modules/vite": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.0.tgz", - "integrity": "sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==", + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz", + "integrity": "sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg==", "dev": true, "peer": true, "dependencies": { diff --git a/package.json b/package.json index d9bd82a6..7dc849b8 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "access": "public" }, "dependencies": { + "merge-props": "^6.0.0", "react-aria": "^3.31.1", "react-stately": "^3.29.1", "rollup-plugin-visualizer": "^5.11.0" diff --git a/src/components/FontSizes/Text.tsx b/src/components/FontSizes/Text.tsx index eeaa0bd3..6c66d1dc 100644 --- a/src/components/FontSizes/Text.tsx +++ b/src/components/FontSizes/Text.tsx @@ -1,16 +1,17 @@ -import React, {HTMLProps} from "react"; -import {Size} from "../../utils/types"; +import React from "react"; +import {Code0Component, Code0Sizes} from "../../utils/types"; import "./Text.style.scss" +import {mergeCode0Props} from "../../utils/utils"; -export interface FontType extends Omit, "children">, "size"> { +export interface FontType extends Omit, "children">, "size"> { children: string, - size: Size, + size: Code0Sizes, hierarchy?: "primary" | "secondary" | "tertiary" } -const Text: React.FC = ({ size, children , hierarchy = "secondary", ...rest }) => { +const Text: React.FC = ({size, children, hierarchy = "secondary", ...rest}) => { - return + return {children} } diff --git a/src/components/alert/Alert.tsx b/src/components/alert/Alert.tsx index 911657d6..0f4b1154 100644 --- a/src/components/alert/Alert.tsx +++ b/src/components/alert/Alert.tsx @@ -1,9 +1,10 @@ -import React, {ReactElement, ReactNode} from "react"; +import React, {ReactNode} from "react"; import {IconAlertCircle, IconCircleCheck, IconCircleX, IconInfoCircle, IconX} from "@tabler/icons-react"; import "./Alert.style.scss" -import {Color} from "../../utils/types"; +import {Code0Component, Color} from "../../utils/types"; +import {mergeCode0Props} from "../../utils/utils"; -export interface AlertType { +export interface AlertType extends Omit, "title"> { children?: ReactNode | ReactNode[] title: ReactNode @@ -28,9 +29,9 @@ const IconColors = { const Alert: React.FC = (props) => { - const {color = "primary", dismissible = false, icon = true, title, onClose = (event) => {}, children} = props + const {color = "primary", dismissible = false, icon = true, title, onClose = (event) => {}, children, ...rest} = props - return
+ return
{icon ? : null} @@ -46,10 +47,6 @@ const Alert: React.FC = (props) => { } -export interface AlertHeadingType { - children: ReactNode -} - export interface AlertIconType { color: Color } @@ -61,5 +58,4 @@ const AlertIcon: React.FC = ({color}) => { } - export default Alert \ No newline at end of file diff --git a/src/components/badge/Badge.tsx b/src/components/badge/Badge.tsx index 942cce73..b33c39c7 100644 --- a/src/components/badge/Badge.tsx +++ b/src/components/badge/Badge.tsx @@ -1,8 +1,9 @@ -import React, {HTMLProps} from "react"; +import React from "react"; import "./Badge.style.scss" -import {Color} from "../../utils/types"; +import {Code0Component, Color} from "../../utils/types"; +import {mergeCode0Props} from "../../utils/utils"; -export interface BadgeType extends HTMLProps{ +export interface BadgeType extends Code0Component{ children: string //defaults to primary color?: Color @@ -12,7 +13,7 @@ const Badge: React.FC = (props) => { const {color = "primary", children, ...args} = props - return + return {children} } diff --git a/src/components/button-group/ButtonGroup.tsx b/src/components/button-group/ButtonGroup.tsx index ce34be67..7a871429 100644 --- a/src/components/button-group/ButtonGroup.tsx +++ b/src/components/button-group/ButtonGroup.tsx @@ -1,16 +1,18 @@ import React, {ReactElement} from "react"; import {ButtonType} from "../button/Button"; import "./ButtonGroup.style.scss" +import {Code0Component} from "../../utils/types"; +import {mergeCode0Props} from "../../utils/utils"; -export interface ButtonGroupType { +export interface ButtonGroupType extends Code0Component { children: ReactElement[] } const ButtonGroup: React.FC = (props) => { - const {children} = props + const {children, ...args} = props - return
+ return
{children.map((child, i) => { return
, HTMLAnchorElement> { +export interface ButtonType extends Code0Component { children: ReactNode | ReactNode[] //defaults to primary color?: Color, @@ -19,7 +17,7 @@ export interface ButtonType extends DetailedHTMLProps{ children: ReactNode } @@ -29,16 +27,17 @@ const Button: React.FC = (props) => { const icon = getChild(children, ButtonIcon) const content = getContent(children, ButtonIcon) - return {icon} {content ? {content} : null} } -const ButtonIcon: React.FC = ({children}) => { - return +const ButtonIcon: React.FC = (props) => { + + const {children, ...args} = props + return {children} } diff --git a/src/components/card/Card.tsx b/src/components/card/Card.tsx index d0074cf0..e40a9122 100644 --- a/src/components/card/Card.tsx +++ b/src/components/card/Card.tsx @@ -1,9 +1,10 @@ -import React, {HTMLProps, ReactElement, ReactNode} from "react"; +import React, {ReactNode} from "react"; import "./Card.style.scss" -import {Color, Size} from "../../utils/types"; +import {Code0Component, Color} from "../../utils/types"; +import {mergeCode0Props} from "../../utils/utils"; -export interface CardType extends HTMLProps { +export interface CardType extends Code0Component { children: ReactNode | ReactNode[] //defaults to secondary color?: Color, @@ -18,7 +19,7 @@ export interface CardType extends HTMLProps { } -export interface SectionType { +export interface SectionType extends Code0Component { children: ReactNode | ReactNode[] //defaults to false image?: boolean, @@ -40,8 +41,7 @@ const Card: React.FC = (props) => { } = props return <> -
+
{children}
@@ -52,12 +52,14 @@ const CardSection: React.FC = (props) => { const { image = false, border = false, - children + children, + ...args } = props; return <> -
{children}
+
+ {children} +
} diff --git a/src/components/col/Col.tsx b/src/components/col/Col.tsx index ba48e428..3efb20f0 100644 --- a/src/components/col/Col.tsx +++ b/src/components/col/Col.tsx @@ -1,9 +1,11 @@ -import React, {HTMLProps, ReactNode} from "react"; +import React, {ReactNode} from "react"; import "./Col.style.scss" +import {Code0Component} from "../../utils/types"; +import {mergeCode0Props} from "../../utils/utils"; export type ColBreakPointRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; -export interface ColType extends HTMLProps { +export interface ColType extends Code0Component { children: ReactNode | ReactNode[] xs?: ColBreakPointRange sm?: ColBreakPointRange @@ -17,7 +19,7 @@ const Col: React.FC = (props) => { const {children, xs, sm, md, lg, xl, xxl, ...args} = props - return
+ return
{children}
} diff --git a/src/components/container/Container.stories.tsx b/src/components/container/Container.stories.tsx index 15699926..966cd153 100644 --- a/src/components/container/Container.stories.tsx +++ b/src/components/container/Container.stories.tsx @@ -62,7 +62,7 @@ export const ContainerWithNews = () => { } export const ContainerRowCol = () => { - return
+ return
@@ -77,17 +77,19 @@ export const ContainerRowCol = () => { - Heading 2 + Heading 3 + + - Heading 2 + Heading 4 - Heading 2 + Heading 5 diff --git a/src/components/container/Container.tsx b/src/components/container/Container.tsx index a227d9eb..1713e191 100644 --- a/src/components/container/Container.tsx +++ b/src/components/container/Container.tsx @@ -1,7 +1,9 @@ -import React, {HTMLProps, ReactNode} from "react"; +import React, {ReactNode} from "react"; import "./Container.style.scss" +import {Code0Component} from "../../utils/types"; +import {mergeCode0Props} from "../../utils/utils"; -export interface ContainerType extends HTMLProps { +export interface ContainerType extends Code0Component { children: ReactNode | ReactNode[] } @@ -9,7 +11,7 @@ const Container: React.FC = (props) => { const {children, ...args} = props - return
+ return
{children}
} diff --git a/src/components/quote/Quote.stories.tsx b/src/components/quote/Quote.stories.tsx index 46fd5b91..3ec42864 100644 --- a/src/components/quote/Quote.stories.tsx +++ b/src/components/quote/Quote.stories.tsx @@ -38,10 +38,12 @@ type QuoteStory = StoryObj; export const QuoteSample: QuoteStory = { render: (args) => { - return + mt={10} + w={"300px"}> My favorite UX feedback from customers is: "How is the app so fast?" Because we’ve built on Next.js and Vercel since day one, our pages load in an instant, diff --git a/src/components/quote/Quote.tsx b/src/components/quote/Quote.tsx index 4bef8f12..9c9d5ddc 100644 --- a/src/components/quote/Quote.tsx +++ b/src/components/quote/Quote.tsx @@ -1,5 +1,4 @@ import React from "react"; -import {TablerIconsProps} from "@tabler/icons-react"; import Card, {CardType} from "../card/Card"; import "./Quote.style.scss" import Text from "../FontSizes/Text"; diff --git a/src/components/row/Row.style.scss b/src/components/row/Row.style.scss index 038eb2dc..4abd38c2 100644 --- a/src/components/row/Row.style.scss +++ b/src/components/row/Row.style.scss @@ -11,6 +11,9 @@ > * { flex-shrink: 0; max-width: 100%; - padding: 0 .5rem; + width: 100%; + padding-left: .5rem; + padding-right: .5rem; + box-sizing: border-box; } } \ No newline at end of file diff --git a/src/components/row/Row.tsx b/src/components/row/Row.tsx index a4099cb6..2b027ee6 100644 --- a/src/components/row/Row.tsx +++ b/src/components/row/Row.tsx @@ -1,7 +1,9 @@ -import React, {HTMLProps, ReactNode} from "react"; +import React, {ReactNode} from "react"; import "./Row.style.scss" +import {Code0Component} from "../../utils/types"; +import {mergeCode0Props} from "../../utils/utils"; -export interface RowType extends HTMLProps { +export interface RowType extends Code0Component { children: ReactNode | ReactNode[] } @@ -9,7 +11,7 @@ const Row: React.FC = (props) => { const {children, ...args} = props - return
+ return
{children}
} diff --git a/src/utils/types.ts b/src/utils/types.ts index f28ff856..3ecc1f82 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -1,7 +1,61 @@ +import React, {HTMLProps} from "react"; + export type Color = "primary" | "secondary" | "info" | "success" | "warning" | "error"; export const Colors: Color[] = ["primary", "secondary", "info", "success", "warning", "error"] -export type Size = "xs" | "sm" | "md" | "lg" | "xl"; +export type Code0Sizes = "xs" | "sm" | "md" | "lg" | "xl"; + +export type Code0FontSizes = "0.75" | "0.8" | "1" | "1.2" | "1.25" + +export type StyleProp = Value; + +export interface Code0ComponentProps { + m?: StyleProp + my?: StyleProp + mx?: StyleProp + mt?: StyleProp + mb?: StyleProp + ml?: StyleProp + mr?: StyleProp + p?: StyleProp + py?: StyleProp + px?: StyleProp + pt?: StyleProp + pb?: StyleProp + pl?: StyleProp + pr?: StyleProp + bg?: React.CSSProperties['backgroundColor']; + c?: React.CSSProperties['color']; + opacity?: React.CSSProperties['opacity']; + ff?: StyleProp<'mono' | 'text' | 'heading' | (string & {})>; + fz?: StyleProp; + fw?: StyleProp; + lts?: StyleProp; + ta?: StyleProp; + lh?: StyleProp; + fs?: StyleProp; + tt?: StyleProp; + td?: StyleProp; + w?: StyleProp; + miw?: StyleProp; + maw?: StyleProp; + h?: StyleProp; + mih?: StyleProp; + mah?: StyleProp; + bgsz?: StyleProp; + bgp?: StyleProp; + bgr?: StyleProp; + bga?: StyleProp; + pos?: StyleProp; + top?: StyleProp; + left?: StyleProp; + bottom?: StyleProp; + right?: StyleProp; + inset?: StyleProp; + display?: StyleProp; + flex?: StyleProp; +} -export const Sizes: Size[] = ["xs", "sm", "md", "lg", "xl"] \ No newline at end of file +export interface Code0Component extends Code0ComponentProps, HTMLProps { +} diff --git a/src/utils/utils.ts b/src/utils/utils.ts index ffbb7f92..31e0b7df 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,4 +1,6 @@ -import React, {ReactNode, useEffect, useMemo, useState} from "react"; +import React, {CSSProperties, HTMLProps, ReactNode, useMemo, useState} from "react"; +import mergeProps from "merge-props"; +import {Code0Component, Code0ComponentProps} from "./types"; export const getChild = (children: ReactNode | ReactNode[], child: React.FC, required?: boolean): React.ReactElement | undefined => { @@ -35,6 +37,59 @@ export interface Positioning { y: number } +const createStyle = (styles: Code0Component): CSSProperties => ({ + ...(styles.m ? {margin: `${styles.m}rem`} : {}), + ...(styles.my ? {marginTop: `${styles.my}rem`, marginBottom: `${styles.my}rem`} : {}), + ...(styles.mx ? {marginLeft: `${styles.mx}rem`, marginRight: `${styles.mx}rem`} : {}), + ...(styles.mt ? {marginTop: `${styles.mt}rem`} : {}), + ...(styles.mb ? {marginBottom: `${styles.mb}rem`} : {}), + ...(styles.ml ? {marginLeft: `${styles.ml}rem`} : {}), + ...(styles.mr ? {marginRight: `${styles.mr}rem`} : {}), + ...(styles.p ? {padding: `${styles.p}rem`} : {}), + ...(styles.py ? {paddingTop: `${styles.py}rem`, paddingBottom: `${styles.py}rem`} : {}), + ...(styles.px ? {paddingLeft: `${styles.px}rem`, paddingRight: `${styles.px}rem`} : {}), + ...(styles.pt ? {paddingTop: `${styles.pt}rem`} : {}), + ...(styles.pb ? {paddingBottom: `${styles.pb}rem`} : {}), + ...(styles.pl ? {paddingLeft: `${styles.pl}rem`} : {}), + ...(styles.pr ? {paddingRight: `${styles.pr}rem`} : {}), + ...(styles.bg ? {backgroundColor: styles.bg} : {}), + ...(styles.c ? {color: styles.c} : {}), + ...(styles.opacity ? {opacity: styles.opacity} : {}), + ...(styles.ff ? {fontFamily: styles.ff} : {}), + ...(styles.fz ? {fontSize: `${styles.fz}rem`} : {}), + ...(styles.ta ? {textAlign: styles.ta} : {}), + ...(styles.w ? {width: styles.w} : {}), + ...(styles.miw ? {minWidth: styles.miw} : {}), + ...(styles.maw ? {maxWidth: styles.maw} : {}), + ...(styles.h ? {height: styles.h} : {}), + ...(styles.mih ? {minHeight: styles.mih} : {}), + ...(styles.mah ? {maxHeight: styles.mah} : {}), + ...(styles.pos ? {position: styles.pos} : {}), + ...(styles.top ? {top: styles.top} : {}), + ...(styles.left ? {left: styles.left} : {}), + ...(styles.bottom ? {bottom: styles.bottom} : {}), + ...(styles.right ? {right: styles.right} : {}), + ...(styles.display ? {display: styles.display} : {}), + ...(styles.flex ? {flex: styles.flex} : {}), + +}) + +export const mergeCode0Props = (cn: string, rest: Code0Component): HTMLProps => { + + const style = createStyle(rest) + const newProps: Code0Component = rest; + const keys: (keyof Code0ComponentProps)[] = ["m", "my", "mx", "mt", "mb", "ml", "mr", "p", "py", "px", "pt", "pb", "pl", "pr", "bg", "c", "opacity", "ff", "fz", "fw", "lts", "ta", "lh", "fs", "tt", "td", "w", "miw", "maw", "h", "mih", "mah", "bgsz", "bgp", "bgr", "bga", "pos", "top", "left", "bottom", "right", "inset", "display", "flex"] + + keys.forEach(key => { + delete newProps[key] + }) + + return mergeProps(newProps, { + className: cn, + ...(Object.keys(style).length !== 0 ? {style: style} : {}) + }) +} + export const getWindowPositioning = (): Omit, "y"> => { return { height: window.innerHeight,