Skip to content

Instantly share code, notes, and snippets.

View albinekb's full-sized avatar
🤖
AgentAgentAgentAgentAgent

Albin Ekblom albinekb

🤖
AgentAgentAgentAgentAgent
View GitHub Profile
@Swapnull
Swapnull / CodeOutput.jsx
Last active November 28, 2020 18:57
Code Ouput for docz
// @flow
import React from 'react';
import SyntaxHighlighter from 'react-syntax-highlighter/prism';
import { dark } from 'react-syntax-highlighter/styles/prism';
import { renderToStaticMarkup } from 'react-dom/server';
import pretty from 'pretty';
import jsxToString from 'jsx-to-string';
type Props = { children: any, showReact?: boolean, showHTML?: boolean, showIcon?: boolean };
type State = { active: number };
import * as React from "react";
import { useMousePosition } from "~/hooks/useMousePosition";
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) {
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {};
const [mouseX, mouseY] = useMousePosition();
const positions = { x, y, h, w, mouseX, mouseY };
return (
<div