import React from 'react'; import { BoxDivProps, SilkeBox } from '../silke-box'; import { SilkeButton, SilkeButtonProps } from '../silke-button'; import { SilkeIcon, SilkeIcons } from '../silke-icon'; import styles from './silke-action-box.scss'; import { SilkeLink } from '../silke-link'; export type ActionBoxKind = 'inline' | 'stacked' | 'centered'; export type SilkeActionBoxProps = { kind: ActionBoxKind; title?: string; children?: React.ReactNode; icon?: SilkeIcons; link?: { label: string; href: string; external?: boolean; }; buttons?: SilkeButtonProps[]; } & Omit; export function SilkeActionBox({ className, title, children, kind = 'inline', icon, link, buttons, ...rest }: SilkeActionBoxProps) { const cl: string[] = [styles.wrapper]; if (className) cl.push(className); if (kind) cl.push(styles[kind]); if (!icon) cl.push(styles.noIcon); return (
{icon && ( )}
{title || children}
{link && ( {link.label} )} {buttons && (
{buttons.map((button, i) => ( ))}
)}
); }