import React from 'react';
import Svg, { Path } from 'react-native-svg';
import { BaseProps } from '../@types/base';
import useTheme from '../context/theme/useTheme';
import { getSxStyleAndProps } from '../lib/sx';
import { ColorName } from '../context';

export function CloseIcon({
  size,
  color = 'text',
  fill = color,
  ...props
}: BaseProps & { fill?: ColorName; size?: number }) {
  const theme = useTheme();

  const sxResult = getSxStyleAndProps(
    {
      ...props,
      width: props?.width ?? size ?? 24,
      height: props?.height ?? size ?? 24,
    },
    theme
  );

  return (
    <Svg
      {...sxResult.props}
      viewBox="0 0 24 24"
      fill="none"
      stroke={theme.colors.get(fill)}
      strokeWidth="3"
      strokeLinecap="round"
      strokeLinejoin="round"
      width={sxResult?.style?.width}
      height={sxResult?.style?.height}
      style={sxResult?.style}
    >
      <Path d="M18 6 6 18" />
      <Path d="m6 6 12 12" />
    </Svg>
  );
}
