Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

816 B
Raw Blame
import type { ReactNode } from "react";

import { Box, Card, FixedSizeIcon, Group, Stack, Text } from "metabase/ui";
import type { IconName } from "metabase-types/api";
type EntitySectionProps = {
  icon: IconName;
  error?: string;
  children?: ReactNode;
};

export function EntitySection({ icon, error, children }: EntitySectionProps) {
  return (
    <Card px="lg" py="xl" withBorder shadow="none">
      <Group align="start" wrap="nowrap">
        <Box p="sm" bg="background_surface-brand-subtle" bdrs="sm">
          <FixedSizeIcon c="core-brand" name={icon} />
        </Box>
        <Stack gap="sm" miw={0}>
          {children}
          {error && (
            <Text c="feedback-negative" size="sm">
              {error}
            </Text>
          )}
        </Stack>
      </Group>
    </Card>
  );
}