mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
21 lines
499 B
TypeScript
21 lines
499 B
TypeScript
import classNames from 'classnames';
|
|
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
|
|
export default function IconComponent(props: { name: string, className?: string } & React.HTMLAttributes<HTMLSpanElement>) {
|
|
const {
|
|
name,
|
|
className,
|
|
...rest
|
|
} = props;
|
|
const cn = classNames(className, `icon icon-${name}`);
|
|
return (
|
|
<span {...rest} className={cn} />
|
|
);
|
|
}
|
|
|
|
IconComponent.propTypes = {
|
|
name: PropTypes.string.isRequired,
|
|
className: PropTypes.string,
|
|
};
|