11'use client'
22
3- import styled from '@emotion/styled'
43import { OpenInNewIcon } from '@ultraviolet/icons'
54import { Stack , Text } from '@ultraviolet/ui'
65import type { AnchorHTMLAttributes , ElementType , ReactNode } from 'react'
76import { forwardRef } from 'react'
7+ import {
8+ customStack ,
9+ fullHeightStack ,
10+ iconWrapper ,
11+ styledWrapper ,
12+ } from './styles.css'
813
914type CardProps = {
1015 title ?: string
@@ -17,53 +22,6 @@ type CardProps = {
1722 target ?: AnchorHTMLAttributes < HTMLAnchorElement > [ 'target' ]
1823}
1924
20- const StyledStack = styled ( Stack ) `
21- min-width: 0;
22- `
23-
24- const IconWrapper = styled . div `
25- display: inline-flex;
26- background: ${ ( { theme } ) => theme . colors . neutral . backgroundWeak } ;
27- padding: ${ ( { theme } ) => theme . space [ '1' ] } ;
28- border-radius: ${ ( { theme } ) => theme . radii . default } ;
29- `
30-
31- const StyledWrapper = styled . a `
32- padding: ${ ( { theme } ) => theme . space [ '3' ] } ;
33- text-decoration: none;
34- height: 100%;
35-
36- &:not(:first-child) {
37- border-top: 1px solid ${ ( { theme } ) => theme . colors . neutral . border } ;
38- }
39-
40- &:first-child {
41- border-radius: ${ ( { theme } ) => theme . radii . default }
42- ${ ( { theme } ) => theme . radii . default } 0 0;
43- }
44-
45- &:last-child {
46- border-radius: 0 0 ${ ( { theme } ) => theme . radii . default }
47- ${ ( { theme } ) => theme . radii . default } ;
48- }
49-
50- & ${ IconWrapper } {
51- background: ${ ( { theme } ) => theme . colors . neutral . backgroundWeak } ;
52- }
53-
54- &:hover {
55- background: ${ ( { theme } ) => theme . colors . neutral . backgroundHover } ;
56-
57- & ${ IconWrapper } {
58- background: none;
59- }
60- }
61- `
62-
63- const FullHeightStack = styled ( Stack ) `
64- height: 100%;
65- `
66-
6725export const Card = forwardRef < HTMLAnchorElement , CardProps > (
6826 (
6927 {
@@ -78,14 +36,15 @@ export const Card = forwardRef<HTMLAnchorElement, CardProps>(
7836 } ,
7937 ref ,
8038 ) => (
81- < StyledWrapper href = { href } ref = { ref } target = { target } >
82- < FullHeightStack
39+ < a className = { styledWrapper } href = { href } ref = { ref } target = { target } >
40+ < Stack
8341 alignItems = "center"
42+ className = { fullHeightStack }
8443 direction = "row"
8544 gap = { 2 }
8645 justifyContent = "space-between"
8746 >
88- < StyledStack gap = "0.5" >
47+ < Stack className = { customStack } gap = "0.5" >
8948 < div >
9049 { subtitle ? (
9150 < Text
@@ -113,11 +72,11 @@ export const Card = forwardRef<HTMLAnchorElement, CardProps>(
11372 </ Text >
11473 ) : null }
11574 { children }
116- </ StyledStack >
117- < IconWrapper >
75+ </ Stack >
76+ < div className = { iconWrapper } >
11877 < OpenInNewIcon sentiment = "neutral" />
119- </ IconWrapper >
120- </ FullHeightStack >
121- </ StyledWrapper >
78+ </ div >
79+ </ Stack >
80+ </ a >
12281 ) ,
12382)
0 commit comments