import { useState } from 'react'; import steelShapes from '../data/steelShapes.json'; interface SteelDatabaseModalProps { isOpen: boolean; onClose: () => void; onSelect: (shape: SteelShape) => void; title?: string; } export interface SteelShape { designation: string; d: number; tw: number; bf: number; tf: number; type: string; } export const SteelDatabaseModal = ({ isOpen, onClose, onSelect, title = "Select Steel Shape" }: SteelDatabaseModalProps) => { const [searchTerm, setSearchTerm] = useState(''); const shapes = steelShapes['W-Shapes'] as SteelShape[]; const filteredShapes = shapes.filter(shape => shape.designation.toLowerCase().includes(searchTerm.toLowerCase()) ); if (!isOpen) return null; return (
e.stopPropagation()}>

{title}

setSearchTerm(e.target.value)} className="search-input" autoFocus />
{filteredShapes.map((shape) => ( ))}
Designation d (in) tw (in) bf (in) tf (in)
{shape.designation} {shape.d.toFixed(2)} {shape.tw.toFixed(3)} {shape.bf.toFixed(3)} {shape.tf.toFixed(3)}
); };