The rectangle icon: a 24 by 24 stroke glyph that takes its colour from the text around it.
registry/behivetech/icons/rectangle · depends on @behivetech/icons.base
rectangle.tsx
1import { createIcon } from "@behivetech/icons.base";23/** The rectangle icon: a stroke glyph on a 24 by 24 grid that inherits the text colour. */4export const RectangleIcon = /*#__PURE__*/ createIcon(5 "RectangleIcon",6 <rect x="2" y="5" width="20" height="14" rx="1" />,7);89export default RectangleIcon;
index.ts
1export { RectangleIcon, default } from "./rectangle.js";
rectangle.example.tsx
1import { RectangleIcon } from "./rectangle.js";23/** The icon at each size; it takes its colour from the surrounding text. */4export const RectangleIconSizes = () => (5 <>6 <RectangleIcon size="sm" />7 <RectangleIcon />8 <RectangleIcon size="lg" />9 <RectangleIcon size="xl" />10 </>11);1213/** Named with `titleAccess`, so assistive technology announces it. */14export const NamedRectangleIcon = () => (15 <RectangleIcon titleAccess="Rectangle" />16);
rectangle.spec.tsx
1import { render } from "@testing-library/react";2import RectangleIconDefault, { RectangleIcon } from "./rectangle.js";34describe("RectangleIcon", () => {5 it("exports the same component by name and by default", () => {6 expect(RectangleIconDefault).toBe(RectangleIcon);7 expect(RectangleIcon.displayName).toBe("RectangleIcon");8 });910 it("draws its glyph and hides from assistive technology", () => {11 const { container } = render(<RectangleIcon />);12 const svg = container.querySelector("svg");1314 expect(15 svg?.querySelector(16 "path, circle, rect, ellipse, line, polyline, polygon",17 ),18 ).not.toBeNull();19 expect(svg?.getAttribute("aria-hidden")).toBe("true");20 });2122 it("is an image named by titleAccess", () => {23 const { container } = render(<RectangleIcon titleAccess="Rectangle" />);24 const svg = container.querySelector("svg");2526 expect(svg?.getAttribute("role")).toBe("img");27 expect(svg?.querySelector("title")?.textContent).toBe("Rectangle");28 });29});