Files
growstuff/app/javascript/components/MenuIcon.jsx
T
Brenda WallaceandClaude Sonnet 5.5 5fed21e811 Keep menu icons in one place and remove unused helpers
The icon drawings were duplicated between Ruby and React; they now live in
app/javascript/menuIcons.json, read by both. Deletes the button and icon helpers
nothing calls any more, and their spec lines.

Part of #4933

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 22:21:26 +13:00

20 lines
765 B
React

import React from 'react';
import ICONS from '../menuIcons.json';
// An action's `key` is not always the icon's name.
const ALIASES = {photo: 'add_photo', plan: 'activity', deactivate: 'archive', activate: 'planting'};
// The green line icon of an actions menu item. The drawings are shared with the
// server-rendered menus (see MENU_ICONS in app/helpers/icons_helper.rb).
export default function MenuIcon({name}) {
const paths = ICONS[ALIASES[name] || name];
if (!paths) return null;
return (
<svg className="menu-icon" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor"
strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"
dangerouslySetInnerHTML={{__html: paths}} />
);
}