@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
31 lines (27 loc) • 974 B
JavaScript
"use client";
import { useInjectVarsIntoCss, useInjectVarsIntoProps } from "../../core/css/use-inject-vars.js";
import { createComponent } from "../../core/components/create-component.js";
import { iconStyle } from "./icon.style.js";
//#region src/components/icon/icon.tsx
const { component, PropsContext: IconPropsContext, usePropsContext: useIconPropsContext, withContext } = createComponent("icon", iconStyle);
/**
* `Icon` is a general icon component that can be used in your projects.
*
* @see https://yamada-ui.com/docs/components/icon
*/
const Icon = withContext("svg")({
"aria-hidden": true,
"data-icon": "",
role: "img",
verticalAlign: "middle"
}, (props) => {
const css = useInjectVarsIntoCss(props.css, { fontSize: "size" });
return {
boxSize: "{size}",
...useInjectVarsIntoProps(props, { fontSize: "size" }),
css
};
});
//#endregion
export { Icon, IconPropsContext, component, useIconPropsContext, withContext };
//# sourceMappingURL=icon.js.map