Files
Stirling-PDF/frontend/src/components/tools/shared/renderToolButtons.tsx
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-09-05 12:16:17 +01:00
import { Box } from '@mantine/core';
2025-08-22 14:40:27 +01:00
import ToolButton from '../toolPicker/ToolButton';
import SubcategoryHeader from './SubcategoryHeader';
import { getSubcategoryLabel } from "../../../data/toolsTaxonomy";
import { TFunction } from 'i18next';
import { SubcategoryGroup } from '../../../hooks/useToolSections';
// Helper function to render tool buttons for a subcategory
export const renderToolButtons = (
t: TFunction,
subcategory: SubcategoryGroup,
selectedToolKey: string | null,
onSelect: (id: string) => void,
2025-09-05 17:12:52 +01:00
showSubcategoryHeader: boolean = true,
disableNavigation: boolean = false
2025-08-22 14:40:27 +01:00
) => (
<Box key={subcategory.subcategoryId} w="100%">
{showSubcategoryHeader && (
<SubcategoryHeader label={getSubcategoryLabel(t, subcategory.subcategoryId)} />
)}
2025-08-26 16:31:20 +01:00
<div>
2025-08-22 14:40:27 +01:00
{subcategory.tools.map(({ id, tool }) => (
<ToolButton
key={id}
id={id}
tool={tool}
isSelected={selectedToolKey === id}
onSelect={onSelect}
2025-09-05 17:12:52 +01:00
disableNavigation={disableNavigation}
2025-08-22 14:40:27 +01:00
/>
))}
2025-08-26 16:31:20 +01:00
</div>
2025-08-22 14:40:27 +01:00
</Box>
);