Files
ossm-configurator/website/src/components/ui/ImageWithFallback.jsx
MunchDev-oss aba0964a59 feat: Add prop-types dependency, implement currency context, and enhance pricing display in components
- Added `prop-types` for better prop validation in components.
- Introduced `CurrencyProvider` to manage currency context and preload exchange rates.
- Updated pricing logic in various components to support new price structure and display currency.
- Refactored BOMSummary, MotorStep, and PowerSupplyStep to utilize new pricing methods and improve user experience.
- Enhanced export utilities to format prices correctly in markdown and Excel outputs.
- Updated hardware and component data structures to include detailed pricing information.
2026-01-10 03:04:28 -05:00

41 lines
739 B
JavaScript

import PropTypes from 'prop-types';
/**
* Image component with error handling fallback
*/
export default function ImageWithFallback({
src,
alt,
className = '',
containerClassName = '',
onError
}) {
const handleError = (e) => {
e.target.style.display = 'none';
if (onError) {
onError(e);
}
};
if (!src) return null;
return (
<div className={containerClassName}>
<img
src={src}
alt={alt}
className={className}
onError={handleError}
/>
</div>
);
}
ImageWithFallback.propTypes = {
src: PropTypes.string,
alt: PropTypes.string.isRequired,
className: PropTypes.string,
containerClassName: PropTypes.string,
onError: PropTypes.func,
};