+
Floating text
@@ -193,7 +224,7 @@ const Container = () => (
@@ -215,8 +246,8 @@ const Container = () => (
Example text
diff --git a/packages/lib/src/container/Container.tsx b/packages/lib/src/container/Container.tsx
index 86ba16425a..36ad1da0cc 100644
--- a/packages/lib/src/container/Container.tsx
+++ b/packages/lib/src/container/Container.tsx
@@ -1,11 +1,10 @@
import styled from "styled-components";
-import { getCoreColorToken } from "../common/coreTokens";
import ContainerPropsType, { BorderProperties, StyledProps } from "./types";
import { spaces } from "../common/variables";
const getBorderStyles = (direction: "top" | "bottom" | "left" | "right", borderProperties: BorderProperties) =>
`border-${direction}: ${borderProperties.width ?? ""} ${borderProperties.style ?? ""} ${
- borderProperties.color ? getCoreColorToken(borderProperties.color) : ""
+ borderProperties.color ?? ""
};`;
const Container = styled.div`
@@ -27,17 +26,27 @@ const Container = styled.div`
box-shadow: ${({ boxShadow }) => boxShadow};
background-attachment: ${({ background }) => background?.attachment};
background-clip: ${({ background }) => background?.clip};
- background-color: ${({ background }) => (background?.color ? getCoreColorToken(background?.color) : "")};
+ background-color: ${({ background }) => background?.color};
background-image: ${({ background }) => background?.image};
background-origin: ${({ background }) => background?.origin};
background-position: ${({ background }) => background?.position};
background-repeat: ${({ background }) => background?.repeat};
background-size: ${({ background }) => background?.size};
border-radius: ${({ borderRadius }) => borderRadius};
- border-width: ${({ border }) => (border && "width" in border ? `${border?.width}` : "")};
- border-style: ${({ border }) => (border && "style" in border ? `${border?.style}` : "")};
- border-color: ${({ border }) =>
- border && "color" in border && border?.color ? `${getCoreColorToken(border?.color)}` : ""};
+ ${({ border }) => {
+ let styles = "";
+ if (border != null) {
+ switch (true) {
+ case "width" in border:
+ styles += border.width ? `border-width: ${border.width};` : "";
+ case "style" in border:
+ styles += border.style ? `border-style: ${border.style};` : "";
+ case "color" in border:
+ styles += border.color ? `border-color: ${border.color};` : "";
+ }
+ }
+ return styles;
+ }};
${({ border }) => {
let styles = "";
if (border != null) {
@@ -59,8 +68,7 @@ const Container = styled.div`
margin-right: ${({ margin }) => (typeof margin === "object" && margin.right ? spaces[margin.right] : "")};
margin-bottom: ${({ margin }) => (typeof margin === "object" && margin.bottom ? spaces[margin.bottom] : "")};
margin-left: ${({ margin }) => (typeof margin === "object" && margin.left ? spaces[margin.left] : "")};
- outline: ${({ outline }) =>
- `${outline?.width ?? ""} ${outline?.style ?? ""} ${outline?.color ? getCoreColorToken(outline?.color) : ""}`};
+ outline: ${({ outline }) => `${outline?.width ?? ""} ${outline?.style ?? ""} ${outline?.color ?? ""}`};
outline-offset: ${({ outline }) => outline?.offset};
overflow: ${({ $overflow }) => (typeof $overflow === "string" ? $overflow : "")};
overflow-x: ${({ $overflow }) => (typeof $overflow === "object" ? `${$overflow?.x}` : "")};
diff --git a/packages/lib/src/container/types.ts b/packages/lib/src/container/types.ts
index 056f6b4cd8..683cac799f 100644
--- a/packages/lib/src/container/types.ts
+++ b/packages/lib/src/container/types.ts
@@ -1,6 +1,5 @@
import { ReactNode } from "react";
-import { CoreColorTokensType } from "../common/coreTokens";
-import { Space as SpacingValues } from "../common/utils"
+import { Space as SpacingValues } from "../common/utils";
type Space =
| SpacingValues
| {
@@ -20,7 +19,7 @@ type Inset = {
type Background = {
attachment?: string;
clip?: string;
- color?: CoreColorTokensType;
+ color?: string;
image?: string;
origin?: string;
position?: string;
@@ -30,8 +29,8 @@ type Background = {
export type BorderProperties = {
width?: string;
- style?: "none" | "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset";
- color?: CoreColorTokensType;
+ style?: string;
+ color?: string;
};
type Border =
| BorderProperties