UNPKG

react-honeycomb

Version:

A library for displaying lists as honeycombs with hexagonal cells in React applications

11 lines (10 loc) 637 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const helpers_1 = require("./helpers"); const Hexagon = ({ children, className, style = {}, }) => { const { gap } = React.useContext(helpers_1.HoneycombContext); const clipPath = `polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%)`; return (React.createElement("div", { className: className, style: Object.assign(Object.assign({}, style), { position: "absolute", top: gap / 2, left: gap / 2, right: gap / 2, bottom: gap / 2, clipPath, pointerEvents: "auto" }) }, children)); }; exports.default = Hexagon;