import type { Meta, StoryObj } from "@storybook/react"; import * as baseIcons from "@simplybusiness/icons"; import "@simplybusiness/icons/iconfont"; import { Icon } from "./Icon"; import { excludeControls } from "../../utils"; import type { IconProps } from "./types"; import { Text } from "../Text"; import { Link } from "../Link"; type StoryType = StoryObj; const meta: Meta = { title: "Components/Icon", component: Icon, argTypes: { ...excludeControls("icon"), }, }; const defaultArgs = { spin: false, spinReverse: false, fixedWidth: false, size: "lg", } as const; const home = { iconName: "home", width: 576, height: 512, svgPathData: "M303.5 13.7L288 .5 272.5 13.7l-264 224 31.1 36.6L64 253.5V488v24H88 488h24V488 253.5l24.5 20.8 31.1-36.6-264-224zM464 212.8V464H112V212.8L288 63.5 464 212.8z", iconType: "fill", fill: "none", } as const; export const Default: StoryType = { render: (args: IconProps) => (

), args: { ...defaultArgs, }, }; export const Spinning: StoryType = { render: (args: IconProps) => (

), args: { ...defaultArgs, spin: true, }, }; const AllIconsComponent = () => ( <> {Object.entries(baseIcons).map(([iconName, icon]) => (
{iconName}
))} ); export const AllIcons: StoryType = { render: () => ( <> Use any icon below with the{" "} Icon component Need an icon not listed here? See the{" "} Adding New Icons{" "} section in the docs. For support, use{" "} #platform-engineering {" "} and tag @fett.
), }; const IconFontComponent = () => ( <> {Object.values(baseIcons).map(icon => (
{icon.iconName}
))} ); export const IconFont: StoryType = { render: () => ( <> Mobius font icons Icon fonts are useful when you need icons in plain HTML/CSS without React components, such as in HAML pages or email templates. To use icon fonts, import the CSS and add the{" "} icon-{"{name}"} class to any element:
        {`/* In your CSS file */
@import '@simplybusiness/icons/iconfont';

/* In your HTML */

`}
      
Available icon font classes
), }; export default meta;