import {Fragment} from 'react'; import styled from '@emotion/styled'; import JSXNode from 'sentry/components/stories/jsxNode'; import SideBySide from 'sentry/components/stories/sideBySide'; import {t} from 'sentry/locale'; import storyBook from 'sentry/stories/storyBook'; import {WidgetFrame} from 'sentry/views/dashboards/widgets/common/widgetFrame'; export default storyBook(WidgetFrame, story => { story('Getting Started', () => { return (

is a container element used for all widgets in the Dashboards Widget Platform. It's mostly an under-the-hood component, but it can be useful to emulate widget-like states, like widget cards with actions.

); }); story('Layout', () => { return (

supports a few basic props that control its content. This includes a title, a description, and the children. The title is automatically wrapped in a tooltip if it does not fit.

); }); story('Warnings', () => { return (

supports a warnings prop. If supplied, it shows a small warning icon next to the title. Hovering over the icon shows the warnings.

); }); story('Badge', () => { return (

supports a badgeProps prop. If passed, aBadge component with the relevant props appears in the header. Note: Avoid using this! This is mostly used as an internal feature, for diagnosing widget state at a glance. We might remove this feature very soon.{' '} Especially avoid multiple badges.

); }); story('Action Menu', () => { return (

supports an action menu. If only one action is passed, the single action is rendered as a small button. If multiple actions are passed, they are grouped into a dropdown menu. Menu actions appear on hover or keyboard focus. They can be disabled with the actionsDisabled prop, and supplemented with an optional actionsMessage prop that adds a tooltip.

{ // eslint-disable-next-line no-console console.log('See more!'); }, }, ]} /> { // eslint-disable-next-line no-console console.log('See more!'); }, }, ]} /> { // eslint-disable-next-line no-console console.log('See more!'); }, }, { key: 'see-less', label: t('See Less'), onAction: () => { // eslint-disable-next-line no-console console.log('See less!'); }, }, ]} /> { // eslint-disable-next-line no-console console.log('See more!'); }, }, { key: 'see-less', label: t('See Less'), onAction: () => { // eslint-disable-next-line no-console console.log('See less!'); }, }, ]} />
); }); story('Full Screen View Button', () => { return (

supports a onOpenFullScreenView{' '} prop. This is a special action that always appears as an individual icon to the right of the normal actions.

{}} />
); }); }); const NormalWidget = styled('div')` width: 250px; height: 100px; `;