forked from redhat-developer/gitops-console-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatternfly-react-core.tsx
More file actions
63 lines (50 loc) · 2.18 KB
/
Copy pathpatternfly-react-core.tsx
File metadata and controls
63 lines (50 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import * as React from 'react';
export const Button: React.FC<any> = ({ children, variant, isInline, component, ...rest }) => (
<button data-variant={variant} {...rest}>{children}</button>
);
export const Popover: React.FC<any> = ({ headerContent, bodyContent, children }) => (
<div data-testid="popover">
<div data-testid="popover-header">{headerContent}</div>
<div data-testid="popover-body">{bodyContent}</div>
{children}
</div>
);
export const MenuToggle = React.forwardRef<any, any>(({ children, variant, ...rest }, ref) => (
<button ref={ref} data-variant={variant} {...rest}>{children}</button>
));
MenuToggle.displayName = 'MenuToggle';
export type MenuToggleElement = HTMLButtonElement;
export type MenuToggleProps = any;
export const Dropdown: React.FC<any> = ({ children, isOpen, toggle, ...props }) => (
<div data-testid="dropdown" data-open={isOpen} {...props}>
{typeof toggle === 'function' ? toggle(null) : toggle}
{isOpen && children}
</div>
);
export const DropdownList: React.FC<any> = ({ children }) => <ul>{children}</ul>;
export const DropdownItem: React.FC<any> = ({ children, description, isDisabled, ...props }) => (
<li data-disabled={isDisabled} {...props}>{children}{description && <small>{description}</small>}</li>
);
export const Tooltip: React.FC<any> = ({ content, children }) => (
<span data-testid="tooltip" data-tooltip={typeof content === 'string' ? content : undefined}>
{children}
</span>
);
export const TooltipPosition = {
top: 'top',
bottom: 'bottom',
left: 'left',
right: 'right',
};
export const Title: React.FC<any> = ({ children, headingLevel: Tag = 'h2', className }) => (
<Tag className={className}>{children}</Tag>
);
export const Label: React.FC<any> = ({ children, className, color, href }) => (
<span data-testid="label" className={className} data-color={color} data-href={href}>{children}</span>
);
export const LabelGroup: React.FC<any> = ({ children, className, numLabels }) => (
<div data-testid="label-group" className={className} data-num-labels={numLabels}>{children}</div>
);
export const Icon: React.FC<any> = ({ children, size }) => (
<span data-testid="icon" data-size={size}>{children}</span>
);