@hitachivantara/uikit-react-icons
Version:
NEXT Design System icons packaged as a set of React components.
51 lines (50 loc) • 1.24 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import { forwardRef } from "react";
import styled from "@emotion/styled";
import { getColor } from "@hitachivantara/uikit-styles";
import { getSizeStyles } from "./utils.js";
function getRotation(rotation) {
switch (rotation) {
case "up":
return "-90deg";
case "down":
return "90deg";
case true:
return "180deg";
case false:
default:
return void 0;
}
}
const StyledIconContainer = styled("div")({
display: "flex",
flex: "0 0 auto",
// ensure icon doesn't flex grow/shrink
fontSize: 16,
// box has a default icon container size of 32px (`xs` & `sm`)
width: "var(--icsize, 32px)",
height: "var(--icsize, 32px)",
transition: "rotate 0.2s ease",
justifyContent: "center",
alignItems: "center"
});
const HvIconContainer = forwardRef(function HvIconContainer2(props, ref) {
const { size, style, color, rotate, children, ...others } = props;
return /* @__PURE__ */ jsx(
StyledIconContainer,
{
ref,
style: {
...getSizeStyles("", size),
color: getColor(color),
rotate: getRotation(rotate),
...style
},
...others,
children
}
);
});
export {
HvIconContainer
};