import React from 'react';
import { CardLink as CardLinkPrimitive, CardLinkProps as CardLinkPropsPrimitive } from '@modulz/primitives';

export type CardLinkProps = CardLinkPropsPrimitive & {
  variant?: 'border' | 'ghost';
}

type ExtractRefType<TypesThatMayContainReactRef> = TypesThatMayContainReactRef extends {ref?: React.Ref<infer T>} ? T : unknown;
type PrimitiveRefType = ExtractRefType<CardLinkPropsPrimitive>  

export const CardLink = React.forwardRef<PrimitiveRefType, CardLinkProps>((props, ref) => {
  return (
    <CardLinkPrimitive {...props} ref={ref}  styleConfig={{"base":{"card":{"normal":{"overflow":"hidden","borderTopRightRadius":"4px","boxShadow":"0 2px 4px 0 rgba(0, 0, 0, 0.15)","backgroundColor":"hsl(0, 0%, 100%)","borderBottomRightRadius":"4px","borderTopLeftRadius":"4px","borderBottomLeftRadius":"4px"}}},"variants":{"variant":{"border":{"card":{"normal":{"border":"1px solid","borderColor":"hsl(240, 5%, 85%)","boxShadow":"none"}}},"ghost":{"card":{"normal":{"boxShadow":"none"}}}}}}}/>
  );
});


