forked from abner/for-legacy-web
Port modal / popover context.
This commit is contained in:
26
src/components/common/Tooltip.tsx
Normal file
26
src/components/common/Tooltip.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import styled from "styled-components";
|
||||
import { Children } from "../../types/Preact";
|
||||
import { Position, Tooltip as TooltipCore, TooltipProps } from "react-tippy";
|
||||
|
||||
type Props = Omit<TooltipProps, 'html'> & {
|
||||
position?: Position;
|
||||
children: Children;
|
||||
content: Children;
|
||||
}
|
||||
|
||||
const TooltipBase = styled.div`
|
||||
padding: 8px;
|
||||
font-size: 12px;
|
||||
border-radius: 4px;
|
||||
color: var(--foreground);
|
||||
background: var(--secondary-background);
|
||||
`;
|
||||
|
||||
export default function Tooltip(props: Props) {
|
||||
return (
|
||||
<TooltipCore
|
||||
{...props}
|
||||
// @ts-expect-error
|
||||
html={<TooltipBase>{props.content}</TooltipBase>} />
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user