Commit e73466a8 by Johannes Schill

panel-header: Make it possible to style the reference element and fix so panel…

panel-header: Make it possible to style the reference element and fix so panel description looks good
parent 0430bb47
......@@ -6,22 +6,24 @@ interface Props {
show: boolean;
placement?: any;
content: string | ((props: any) => JSX.Element);
refClassName?: string;
}
class Popper extends PureComponent<Props> {
render() {
const { children, renderContent, show, placement } = this.props;
const { children, renderContent, show, placement, refClassName } = this.props;
const { content } = this.props;
const modifiers = {
flip: { enabled: false },
preventOverflow: { enabled: false },
hide: { enabled: false },
};
return (
<Manager>
<Reference>{({ ref }) => <div ref={ref}>{children}</div>}</Reference>
<Reference>
{({ ref }) => (
<div className={`popper_ref ${refClassName || ''}`} ref={ref}>
{children}
</div>
)}
</Reference>
{show && (
<ReactPopper placement={placement} modifiers={modifiers}>
<ReactPopper placement={placement}>
{({ ref, style, placement, arrowProps }) => {
return (
<div ref={ref} style={style} data-placement={placement} className="popper">
......
......@@ -8,11 +8,13 @@ export interface UsingPopperProps {
placement?: string;
content: string | ((props: any) => JSX.Element);
className?: string;
refClassName?: string;
}
interface Props {
placement?: string;
className?: string;
refClassName?: string;
content: string | ((props: any) => JSX.Element);
}
......
......@@ -45,11 +45,13 @@ export class PanelHeader extends PureComponent<Props, State> {
return (
<div className={panelHeaderClass}>
{panel.description && (
<Tooltip content={panel.description}>
<span className="panel-info-corner panel-info-corner--info">
<i className="fa" />
<span className="panel-info-corner-inner" />
</span>
<Tooltip
content={panel.description}
className="absolute"
refClassName="panel-info-corner panel-info-corner--info"
>
<i className="fa" />
<span className="panel-info-corner-inner" />
</Tooltip>
)}
{isLoading && (
......
......@@ -78,3 +78,7 @@ button.close {
.d-inline-block {
display: inline-block;
}
.absolute {
position: absolute;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment