import React from 'react'; import { Text, IconButton } from 'soapbox/components/ui'; import HStack from 'soapbox/components/ui/hstack/hstack'; import Stack from 'soapbox/components/ui/stack/stack'; interface IWidgetTitle { /** Title text for the widget. */ title: React.ReactNode, } /** Title of a widget. */ const WidgetTitle = ({ title }: IWidgetTitle): JSX.Element => ( {title} ); /** Body of a widget. */ const WidgetBody: React.FC = ({ children }): JSX.Element => ( {children} ); interface IWidget { /** Widget title text. */ title: React.ReactNode, /** Callback when the widget action is clicked. */ onActionClick?: () => void, /** URL to the svg icon for the widget action. */ actionIcon?: string, /** Text for the action. */ actionTitle?: string, action?: JSX.Element, } /** Sidebar widget. */ const Widget: React.FC = ({ title, children, onActionClick, actionIcon = require('@tabler/icons/arrow-right.svg'), actionTitle, action, }): JSX.Element => { return ( {action || (onActionClick && ( ))} {children} ); }; export default Widget;