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 SvgDog = ({
|
|
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="M10.667 9.333v.334m-7.72-2.169a8.769 8.769 0 0 0-.28 2.206C2.667 12.485 5.055 14 8 14c2.945 0 5.333-1.515 5.333-4.296a7.802 7.802 0 0 0-.328-2.206M5.333 9.333v.334m.334-4c-.256.7-.722 1.352-1.563 1.666-1.287.482-2.384-.198-2.437-.666C1.59 6.004 2.45 2.313 4.333 2c1.282-.214 2.434.563 2.434 1.49a4.998 4.998 0 0 1 2.566.028c0-.927 1.23-1.732 2.512-1.518 1.882.313 2.742 4.004 2.666 4.667-.053.468-1.15 1.148-2.437.666-.84-.314-1.237-.966-1.493-1.666M7.5 10.833h1l-.5.5-.5-.5Z"
|
|
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);
|
|
};
|
|
SvgDog.displayName = 'SvgDog';
|
|
export default SvgDog;
|