@kiwicom/orbit-components
Version:
Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.
64 lines (63 loc) • 1.79 kB
JavaScript
"use client";
import * as React from "react";
import cx from "clsx";
import { getSpaceAfterClasses } from "../common/tailwind";
const BORDER_TYPE_CLASSES = {
none: "border-none",
solid: "border-solid",
dashed: "border-dashed",
dotted: "border-dotted",
double: "border-double"
};
var Indent = /*#__PURE__*/function (Indent) {
Indent["none"] = "none";
Indent["small"] = "small";
Indent["medium"] = "medium";
Indent["large"] = "large";
Indent["XLarge"] = "XLarge";
Indent["XXLarge"] = "XXLarge";
return Indent;
}(Indent || {});
function getSideOffsetAmount(indent, align) {
const classes = {
left: {
[]: "pe-0",
[]: "pe-sm",
[]: "pe-md",
[]: "pe-lg",
[]: "pe-xl",
[]: "pe-xxl"
},
right: {
[]: "ps-0",
[]: "ps-sm",
[]: "ps-md",
[]: "ps-lg",
[]: "ps-xl",
[]: "ps-xxl"
},
center: {
[]: "px-0",
[]: "px-sm",
[]: "px-md",
[]: "px-lg",
[]: "px-xl",
[]: "px-xxl"
}
};
return classes[align][indent];
}
const Separator = ({
align = "left",
sideOffset = "none",
spaceAfter,
type = "solid",
color
}) => {
return /*#__PURE__*/React.createElement("div", {
className: cx("box-border w-full", getSideOffsetAmount(sideOffset, align))
}, /*#__PURE__*/React.createElement("hr", {
className: cx("orbit-separator", "mt-0 box-border h-0 border-t", color || "border-elevation-flat-border-color", BORDER_TYPE_CLASSES[type], spaceAfter && getSpaceAfterClasses(spaceAfter))
}));
};
export default Separator;