@stratakit/bricks
Version:
Small, modular components for StrataKit
35 lines (34 loc) • 1.03 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import {
createIconFromPath,
forwardRef
} from "@stratakit/foundations/secret-internals";
import cx from "classnames";
const disclosureIcons = {
/** caret-down.svg */
down: createIconFromPath(
"M9.646 6.896a.5.5 0 0 1 .707.707l-2 2a.5.5 0 0 1-.707 0l-2-2-.064-.078a.5.5 0 0 1 .693-.693l.078.064L8 8.543l1.646-1.647Z"
),
/** caret-right.svg */
right: createIconFromPath(
"M6.896 5.646a.501.501 0 0 1 .629-.064l.078.064 2 2a.5.5 0 0 1 0 .707l-2 2a.5.5 0 1 1-.707-.707L8.543 8 6.896 6.353l-.064-.078a.501.501 0 0 1 .064-.629Z"
)
};
const DisclosureArrow = forwardRef(
(props, forwardedRef) => {
const { direction = "down", ...rest } = props;
const Element = disclosureIcons[direction];
return /* @__PURE__ */ jsx(
Element,
{
...rest,
className: cx("\u{1F95D}-disclosure-arrow", props.className),
ref: forwardedRef
}
);
}
);
DEV: DisclosureArrow.displayName = "DisclosureArrow";
export {
DisclosureArrow
};