mirror of
https://github.com/hanzoai/o11y-icons.git
synced 2026-11-03 02:09:25 +00:00
69 lines
2.4 KiB
TypeScript
69 lines
2.4 KiB
TypeScript
import type React from 'react';
|
|
import { cloneElement } from 'react';
|
|
import type { IconSize } from '../icon-config.js';
|
|
import { ICON_SIZE_MAP, STROKE_WIDTH_MAP } from '../icon-config.js';
|
|
export interface IconProps extends React.SVGProps<SVGSVGElement> {
|
|
size?: IconSize | number;
|
|
strokeWidth?: number;
|
|
className?: string;
|
|
}
|
|
const SvgRadiation = ({
|
|
color = 'currentColor',
|
|
size,
|
|
strokeWidth,
|
|
className,
|
|
...props
|
|
}: IconProps): React.ReactElement => {
|
|
const element = (
|
|
<svg width={16} height={16} fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
<path
|
|
d="M8 8h.007M5 2.8c-.2-.333-.6-.467-.866-.267-1.534 1.134-2.6 2.867-2.8 4.8C1.267 7.667 1.6 8 2 8h3.334c0-1 .533-1.867 1.333-2.267A199.516 199.516 0 0 1 5 2.8ZM14 8c.4 0 .667-.267.667-.667-.2-1.933-1.2-3.666-2.733-4.733-.267-.2-.734-.133-.867.2-.4.6-1 1.667-1.733 2.867A2.689 2.689 0 0 1 10.667 8H14Zm-9 5.2c-.2.333-.066.733.267.867 1.733.8 3.733.8 5.467 0 .333-.134.466-.534.266-.867-.333-.6-.933-1.667-1.666-2.867-.8.467-1.867.467-2.667 0A80.67 80.67 0 0 0 5 13.2Z"
|
|
stroke="#2A2E37"
|
|
strokeWidth={1.33}
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
/>
|
|
</svg>
|
|
);
|
|
const hasViewBox = element.props.viewBox != null;
|
|
const isCustomIcon = element.props['data-custom-icon'] === 'true';
|
|
const defaultSize = isCustomIcon ? element.props.width : ICON_SIZE_MAP.xs;
|
|
const resolvedSize =
|
|
size != null ? (typeof size === 'number' ? size : ICON_SIZE_MAP[size]) : defaultSize;
|
|
const resolvedStrokeWidth =
|
|
strokeWidth != null
|
|
? strokeWidth
|
|
: typeof size === 'string' && size in STROKE_WIDTH_MAP
|
|
? STROKE_WIDTH_MAP[size]
|
|
: size == null
|
|
? STROKE_WIDTH_MAP.xs
|
|
: 2;
|
|
const w = element.props.width != null ? Number(element.props.width) : 24;
|
|
const h = element.props.height != null ? Number(element.props.height) : 24;
|
|
const viewBoxWhenMissing = `0 0 ${w} ${h}`;
|
|
const elementProps = {
|
|
...props,
|
|
className: className ? `signoz-icon ${className}` : 'signoz-icon',
|
|
...(!isCustomIcon && {
|
|
stroke: color,
|
|
strokeWidth: resolvedStrokeWidth,
|
|
}),
|
|
...(!isCustomIcon &&
|
|
!hasViewBox && {
|
|
viewBox: viewBoxWhenMissing,
|
|
}),
|
|
...(isCustomIcon && {
|
|
style: {
|
|
color,
|
|
...props.style,
|
|
},
|
|
viewBox: viewBoxWhenMissing,
|
|
}),
|
|
width: resolvedSize,
|
|
height: resolvedSize,
|
|
};
|
|
return cloneElement(element, elementProps);
|
|
};
|
|
SvgRadiation.displayName = 'SvgRadiation';
|
|
export default SvgRadiation;
|