All files / libs/payout-definition/plans/components/src/lib/plan-awards/award-details PlanAwardDetails.tsx

0% Statements 0/62
0% Branches 0/1
0% Functions 0/1
0% Lines 0/62

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63                                                                                                                             
import { css } from '@emotion/react';
import { memo } from 'react';

import { Group, Stack, Typography } from '@allshares/studio-design-system';
import { type BadgeConfiguration } from '@amalia/payout-definition/plans/types';

import { PlanAwardIcon } from '../award-icon/PlanAwardIcon';

export type PlanAwardDetailsProps = {
  /** Award configuration. */
  readonly configuration: BadgeConfiguration;
  /** If false, the award is available but not won. */
  readonly isAwarded?: boolean;
};

export const PlanAwardDetails = memo(function PlanAwardDetails({
  configuration,
  isAwarded = true,
}: PlanAwardDetailsProps) {
  return (
    <Group
      align="center"
      gap={16}
    >
      <PlanAwardIcon
        icon={configuration.icon}
        isAwarded={isAwarded}
        size={48}
      />

      <Stack gap={4}>
        <Typography
          variant="bodyBaseMedium"
          css={(theme) => css`
            color: ${isAwarded ? theme.ds.colors.gray[900] : theme.ds.colors.gray[500]};

            [data-color-scheme='dark'] & {
              color: ${isAwarded ? theme.ds.colors.gray[100] : theme.ds.colors.gray[600]};
            }
          `}
        >
          {configuration.name}
        </Typography>

        {!!configuration.description && (
          <Typography
            variant="bodyXsmallRegular"
            css={(theme) => css`
              color: ${isAwarded ? theme.ds.colors.gray[700] : theme.ds.colors.gray[400]};

              [data-color-scheme='dark'] & {
                color: ${isAwarded ? theme.ds.colors.gray[400] : theme.ds.colors.gray[700]};
              }
            `}
          >
            {configuration.description}
          </Typography>
        )}
      </Stack>
    </Group>
  );
});