Skip to content

FE-620: DS icon component#8661

Merged
alex-e-leon merged 19 commits intomainfrom
FE-620-ds-icon-component
Apr 29, 2026
Merged

FE-620: DS icon component#8661
alex-e-leon merged 19 commits intomainfrom
FE-620-ds-icon-component

Conversation

@alex-e-leon
Copy link
Copy Markdown
Contributor

@alex-e-leon alex-e-leon commented Apr 28, 2026

🌟 What is the purpose of this PR?

Adds an Icon component to the DS. Once I've created a button component and updated petrinaut to use this component I may need to come back and update some properties.

Because we are using font awesome's pro icon set we can't re-export (or import) all of font-awesomes Icon set, so instead I've manually copied over the subset that we use. We also won't be able to allow users to select an icon in our UI's so we'll need to ban that ui pattern somehow.

Pre-Merge Checklist 🚀

This PR:

  • modifies an npm-publishable library and I have added a changeset file(s)

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment Apr 29, 2026 1:26pm
hashdotdesign-tokens Ready Ready Preview, Comment Apr 29, 2026 1:26pm
petrinaut Error Error Apr 29, 2026 1:26pm

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 28, 2026

PR Summary

Medium Risk
Introduces a large set of bundled SVG assets and new SVGR build tooling, which can affect bundle size and library build/consumer compatibility if SVG transforms or type declarations differ across environments.

Overview
Adds a new Icon component to @hashintel/ds-components, backed by an internal map of bundled Font Awesome SVGs, with size variants (xslg) and basic accessibility via optional alt.

Updates the package build/demo pipeline to support importing .svg files as React components (adds SVGR to tsdown and Vite/Ladle typings), exports Icon/IconName/iconNames from src/main.ts, and includes a changeset for a patch release.

Reviewed by Cursor Bugbot for commit 14d7e16. Bugbot is set up for automated code reviews on this repo. Configure here.

@alex-e-leon alex-e-leon changed the title Fe 620 ds icon component FE-620: DS icon component Apr 28, 2026
@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team area/apps > hash.design Affects the `hash.design` design site (app) labels Apr 28, 2026
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Apr 28, 2026

🤖 Augment PR Summary

Summary: Adds a new Icon component to @hashintel/ds-components using a curated subset of Font Awesome Pro SVGs.
Changes:

  • Added Icon component with name→SVG mapping and size variants (xs–lg)
  • Added Panda recipe (icon.recipe.ts) to standardize sizing via --icon-size
  • Added Ladle stories to demo default usage, sizes, and an icon grid
  • Moved Ladle type declarations into .ladle/types.d.ts and added an SVG module declaration
  • Enabled SVG-to-React importing for Ladle via vite-plugin-svgr in vite.config.ts
  • Added a license notice alongside the copied SVG assets
Why: Font Awesome Pro icons can’t be wholesale re-exported, so the DS ships only the subset used by HASH.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread libs/@hashintel/ds-components/src/components/Icon/icon.tsx
Comment thread libs/@hashintel/ds-components/src/components/Icon/icon.tsx
Comment thread libs/@hashintel/ds-components/.ladle/types.d.ts Outdated
Comment thread libs/@hashintel/ds-components/src/components/Icon/icon.tsx
Comment thread libs/@hashintel/ds-components/src/components/Icon/icon.tsx
Comment thread libs/@hashintel/ds-components/.ladle/types.d.ts
Comment thread libs/@hashintel/ds-components/src/components/Icon/icon.tsx
Comment thread libs/@hashintel/ds-components/src/components/Icon/icon.tsx
Comment thread libs/@hashintel/ds-components/src/components/Icon/icon.tsx Outdated
@lunelson
Copy link
Copy Markdown
Contributor

So, FTR I must say I'm not convinced svgr should be our solution for integrating Font Awesome Pro icons in the DS. It provides good local ergonomics, but the SVG markup becomes part of the shipped JS and part of React’s rendered tree, which costs in bundle size, parse/compile work, and more React-managed markup and memory overhead

Personally I’d strongly prefer something like:

  • maintain an explicit approved icon manifest;
  • generate subset sprite files containing only icons actually used by the product;
  • expose a very small Icon component that renders <svg><use href="...#icon-name" /></svg>;
  • style via panda tokens / currentColor, not icon-specific component APIs

@lunelson
Copy link
Copy Markdown
Contributor

lunelson commented Apr 29, 2026

Some context: Breaking Up with SVG-in-JS

@alex-e-leon
Copy link
Copy Markdown
Contributor Author

So, FTR I must say I'm not convinced svgr should be our solution for integrating Font Awesome Pro icons in the DS. It provides good local ergonomics, but the SVG markup becomes part of the shipped JS and part of React’s rendered tree, which costs in bundle size, parse/compile work, and more React-managed markup and memory overhead

Personally I’d strongly prefer something like:

  • maintain an explicit approved icon manifest;
  • generate subset sprite files containing only icons actually used by the product;
  • expose a very small Icon component that renders <svg><use href="...#icon-name" /></svg>;
  • style via panda tokens / currentColor, not icon-specific component APIs

I 100% agree - I plan on implementing spriting down the line.

I've used svgr for now because its much simpler to setup and get working, while I'm a little uncertain how the pipeline for spriting will work for consumers right now.

My plan was once I've finished a couple of these components and got a consumer (likely petrinaut) actually consuming the icons properly to then come back and implement spriting so that I have a real consumer to test the spriting pipeline.

@alex-e-leon
Copy link
Copy Markdown
Contributor Author

alex-e-leon commented Apr 29, 2026

  • maintain an explicit approved icon manifest;

What exactly do you mean by a manifest?

  • style via panda tokens / currentColor, not icon-specific component APIs

Agree - this is how the icon component works at the moment.

Comment thread libs/@hashintel/ds-components/src/components/Icon/icon.tsx
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 41b4603. Configure here.

Comment thread libs/@hashintel/ds-components/src/types.d.ts
Copy link
Copy Markdown
Contributor

  • What exactly do you mean by a manifest?

Just a central definition of which icons should go in to the sprite

@alex-e-leon alex-e-leon added this pull request to the merge queue Apr 29, 2026
Merged via the queue into main with commit 79eda1e Apr 29, 2026
45 checks passed
@alex-e-leon alex-e-leon deleted the FE-620-ds-icon-component branch April 29, 2026 17:31
@hashdotai hashdotai mentioned this pull request Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash.design Affects the `hash.design` design site (app) area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team type/legal Owned by the @legal team

Development

Successfully merging this pull request may close these issues.

2 participants