UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

52 lines (51 loc) 1.41 kB
/** * @jsxRuntime classic * @jsx jsx */ import { useEffect, useRef } from 'react'; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766 import { css, jsx } from '@emotion/react'; import { ButtonItem, Section } from '@atlaskit/menu'; const itemBefore = css({ width: '40px', height: '40px', boxSizing: 'border-box', display: 'flex', justifyContent: 'center', alignItems: 'center', marginRight: "var(--ds-space-050, 4px)" }); export const ViewMore = ({ item, focus }) => { const ref = useRef(null); useEffect(() => { if (ref.current && focus) { ref.current.focus(); } }, [focus]); return jsx(Section, { hasSeparator: true }, jsx(ButtonItem // Ignored via go/ees005 // eslint-disable-next-line @typescript-eslint/no-explicit-any , { onClick: item.action // Ignored via go/ees005 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion , iconBefore: jsx("div", { css: itemBefore }, item.icon()), "aria-describedby": item.title, "data-testid": "view-more-elements-item" // @ts-ignore Overriding Menu styles is not supported // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 , css: css({ padding: `0px ${"var(--ds-space-150, 12px)"}` }), ref: ref }, item.title)); };