UNPKG

@reusable-ui/icon

Version:

An icon set component for React app.

42 lines (41 loc) 1.11 kB
import { Factory, CssKnownProps, CssRule, CssVars } from '@cssfn/core'; import type { IconProps } from '../Icon.js'; export interface IconVars { /** * Icon's image url or icon name. */ image: any; /** * Icon's block-size (height). */ size: any; /** * Icon's ratio of width/height. */ ratio: any; /** * Icon's color. */ color: any; } export interface IconStuff { iconRule: Factory<CssRule>; iconVars: CssVars<IconVars>; } export interface IconConfig { image?: CssKnownProps['content']; size?: CssKnownProps['blockSize']; color?: CssKnownProps['backgroundColor']; } /** * Uses icon image and icon color. * @param config A configuration of `iconRule`. * @returns A `IconStuff` represents the icon rules. */ export declare const usesIcon: (config?: IconConfig) => IconStuff; export declare const useIcon: <TElement extends Element = HTMLSpanElement>({ icon }: IconProps<TElement>) => { class: string | null; style: { [x: string]: string | undefined; }; };