Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

1.5 KB
Raw Blame
'use client';

import { createStaticStyles, cssVar, cx, Flexbox, Icon, Text } from '@lobehub/ui';
import type { LucideIcon } from 'lucide-react';
import type { ReactNode } from 'react';
import { memo } from 'react';

import { densityVars } from '@/styles/densityVars';

const styles = createStaticStyles(({ css }) => ({
  card: css`
    align-self: flex-start;

    width: calc(50% - 4px);
    padding: ${densityVars.cardPadding};
    border: 1px solid ${cssVar.colorBorderSecondary};
    border-radius: ${cssVar.borderRadiusLG};

    background: ${cssVar.colorBgContainer};

    @container (max-width: 840px) {
      width: 100%;
    }
  `,
  fullWidth: css`
    width: 100%;
  `,
  title: css`
    font-size: ${densityVars.fontSize};
    font-weight: 500;
  `,
}));

interface WorkspaceAgentPolicyCardProps {
  action?: ReactNode;
  children?: ReactNode;
  fullWidth?: boolean;
  icon: LucideIcon;
  title: ReactNode;
}

export const WorkspaceAgentPolicyCard = memo<WorkspaceAgentPolicyCardProps>(
  ({ action, children, fullWidth, icon, title }) => (
    <Flexbox className={cx(styles.card, fullWidth && styles.fullWidth)} gap={12}>
      <Flexbox horizontal align={'center'} justify={'space-between'}>
        <Flexbox horizontal align={'center'} gap={8}>
          <Icon icon={icon} size={16} />
          <Text className={styles.title}>{title}</Text>
        </Flexbox>
        {action}
      </Flexbox>
      {children}
    </Flexbox>
  ),
);

WorkspaceAgentPolicyCard.displayName = 'WorkspaceAgentPolicyCard';