Chore: move shared components to components/
This commit is contained in:
19
src/components/FAIcon/FAIcon.tsx
Normal file
19
src/components/FAIcon/FAIcon.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import React, { FC } from 'react';
|
||||
import { cx } from 'emotion';
|
||||
|
||||
interface Props {
|
||||
icon: string;
|
||||
customClass?: string;
|
||||
}
|
||||
|
||||
export const FAIcon: FC<Props> = ({ icon, customClass }) => {
|
||||
const wrapperClass = cx('fa-icon-container', customClass);
|
||||
|
||||
return (
|
||||
<span className={wrapperClass}>
|
||||
<i className={`fa fa-${icon}`}></i>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export default FAIcon;
|
||||
22
src/components/GFHeartIcon/GFHeartIcon.tsx
Normal file
22
src/components/GFHeartIcon/GFHeartIcon.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import React, { FC } from 'react';
|
||||
import { cx } from 'emotion';
|
||||
|
||||
interface Props {
|
||||
status: 'critical' | 'warning' | 'online' | 'ok' | 'problem';
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export const GFHeartIcon: FC<Props> = ({ status, className }) => {
|
||||
const iconClass = cx(
|
||||
className,
|
||||
'icon-gf',
|
||||
{ "icon-gf-critical": status === 'critical' || status === 'problem' || status === 'warning'},
|
||||
{ "icon-gf-online": status === 'online' || status === 'ok' },
|
||||
);
|
||||
|
||||
return (
|
||||
<i className={iconClass}></i>
|
||||
);
|
||||
};
|
||||
|
||||
export default GFHeartIcon;
|
||||
@@ -2,7 +2,7 @@ import React, { FC } from 'react';
|
||||
import Popper from './Popper';
|
||||
import withPopper, { UsingPopperProps } from './withPopper';
|
||||
|
||||
const Tooltip: FC<UsingPopperProps> = ({ hidePopper, showPopper, className, children, ...restProps }) => {
|
||||
const TooltipWrapper: FC<UsingPopperProps> = ({ hidePopper, showPopper, className, children, ...restProps }) => {
|
||||
return (
|
||||
<div className={`popper__manager ${className}`} onMouseEnter={showPopper} onMouseLeave={hidePopper}>
|
||||
<Popper {...restProps}>{children}</Popper>
|
||||
@@ -10,4 +10,6 @@ const Tooltip: FC<UsingPopperProps> = ({ hidePopper, showPopper, className, chil
|
||||
);
|
||||
};
|
||||
|
||||
export default withPopper(Tooltip);
|
||||
export const Tooltip = withPopper(TooltipWrapper);
|
||||
|
||||
export default Tooltip;
|
||||
|
||||
3
src/components/index.ts
Normal file
3
src/components/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export { GFHeartIcon } from './GFHeartIcon/GFHeartIcon';
|
||||
export { FAIcon } from './FAIcon/FAIcon';
|
||||
export { Tooltip } from './Tooltip/Tooltip';
|
||||
Reference in New Issue
Block a user