The car icon: a 24 by 24 stroke glyph that takes its colour from the text around it.

pnpm add @behivetech/icons.car
  • icon

registry/behivetech/icons/car · depends on @behivetech/icons.base

car.tsx
1import { createIcon } from "@behivetech/icons.base";
2
3/** The car icon: a stroke glyph on a 24 by 24 grid that inherits the text colour. */
4export const CarIcon = /*#__PURE__*/ createIcon(
5 "CarIcon",
6 <>
7 <path d="M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2" />
8 <circle cx="7" cy="17" r="2" />
9 <path d="M9 17h6" />
10 <circle cx="17" cy="17" r="2" />
11 </>,
12);
13
14export default CarIcon;
index.ts
1export { CarIcon, default } from "./car.js";
car.example.tsx
1import { CarIcon } from "./car.js";
2
3/** The icon at each size; it takes its colour from the surrounding text. */
4export const CarIconSizes = () => (
5 <>
6 <CarIcon size="sm" />
7 <CarIcon />
8 <CarIcon size="lg" />
9 <CarIcon size="xl" />
10 </>
11);
12
13/** Named with `titleAccess`, so assistive technology announces it. */
14export const NamedCarIcon = () => <CarIcon titleAccess="Car" />;
car.spec.tsx
1import { render } from "@testing-library/react";
2import CarIconDefault, { CarIcon } from "./car.js";
3
4describe("CarIcon", () => {
5 it("exports the same component by name and by default", () => {
6 expect(CarIconDefault).toBe(CarIcon);
7 expect(CarIcon.displayName).toBe("CarIcon");
8 });
9
10 it("draws its glyph and hides from assistive technology", () => {
11 const { container } = render(<CarIcon />);
12 const svg = container.querySelector("svg");
13
14 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 });
21
22 it("is an image named by titleAccess", () => {
23 const { container } = render(<CarIcon titleAccess="Car" />);
24 const svg = container.querySelector("svg");
25
26 expect(svg?.getAttribute("role")).toBe("img");
27 expect(svg?.querySelector("title")?.textContent).toBe("Car");
28 });
29});