Commit 835c62ac authored by Jordan Frankfurt's avatar Jordan Frankfurt Committed by GitHub

fix: use ephemeral props for styled component (#6607)

* fix: use ephemeral props for styled component

* add
parent 8fe7c7a0
...@@ -10,14 +10,14 @@ export enum CardType { ...@@ -10,14 +10,14 @@ export enum CardType {
Secondary = 'Secondary', Secondary = 'Secondary',
} }
const StyledCard = styled.div<{ isDarkMode: boolean; backgroundImgSrc?: string; type: CardType }>` const StyledCard = styled.div<{ $isDarkMode: boolean; $backgroundImgSrc?: string; $type: CardType }>`
display: flex; display: flex;
background: ${({ isDarkMode, backgroundImgSrc, type, theme }) => background: ${({ $isDarkMode, $backgroundImgSrc, $type, theme }) =>
isDarkMode $isDarkMode
? `${type === CardType.Primary ? theme.backgroundModule : theme.backgroundSurface} ${ ? `${$type === CardType.Primary ? theme.backgroundModule : theme.backgroundSurface} ${
backgroundImgSrc ? ` url(${backgroundImgSrc})` : '' $backgroundImgSrc ? ` url(${$backgroundImgSrc})` : ''
}` }`
: `${type === CardType.Primary ? 'white' : theme.backgroundModule} url(${backgroundImgSrc})`}; : `${$type === CardType.Primary ? 'white' : theme.backgroundModule} url(${$backgroundImgSrc})`};
background-size: auto 100%; background-size: auto 100%;
background-position: right; background-position: right;
background-repeat: no-repeat; background-repeat: no-repeat;
...@@ -30,15 +30,15 @@ const StyledCard = styled.div<{ isDarkMode: boolean; backgroundImgSrc?: string; ...@@ -30,15 +30,15 @@ const StyledCard = styled.div<{ isDarkMode: boolean; backgroundImgSrc?: string;
padding: 24px; padding: 24px;
height: 212px; height: 212px;
border-radius: 24px; border-radius: 24px;
border: 1px solid ${({ theme, type }) => (type === CardType.Primary ? 'transparent' : theme.backgroundOutline)}; border: 1px solid ${({ theme, $type }) => ($type === CardType.Primary ? 'transparent' : theme.backgroundOutline)};
box-shadow: 0px 10px 24px 0px rgba(51, 53, 72, 0.04); box-shadow: 0px 10px 24px 0px rgba(51, 53, 72, 0.04);
transition: ${({ theme }) => `${theme.transition.duration.medium} ${theme.transition.timing.ease} border`}; transition: ${({ theme }) => `${theme.transition.duration.medium} ${theme.transition.timing.ease} border`};
&:hover { &:hover {
border: 1px solid ${({ theme, isDarkMode }) => (isDarkMode ? theme.backgroundInteractive : theme.textTertiary)}; border: 1px solid ${({ theme, $isDarkMode }) => ($isDarkMode ? theme.backgroundInteractive : theme.textTertiary)};
} }
@media screen and (min-width: ${BREAKPOINTS.sm}px) { @media screen and (min-width: ${BREAKPOINTS.sm}px) {
height: ${({ backgroundImgSrc }) => (backgroundImgSrc ? 360 : 260)}px; height: ${({ $backgroundImgSrc }) => ($backgroundImgSrc ? 360 : 260)}px;
} }
@media screen and (min-width: ${BREAKPOINTS.xl}px) { @media screen and (min-width: ${BREAKPOINTS.xl}px) {
padding: 32px; padding: 32px;
...@@ -125,14 +125,14 @@ const Card = ({ ...@@ -125,14 +125,14 @@ const Card = ({
return ( return (
<TraceEvent events={[BrowserEvent.onClick]} name={SharedEventName.ELEMENT_CLICKED} element={elementName}> <TraceEvent events={[BrowserEvent.onClick]} name={SharedEventName.ELEMENT_CLICKED} element={elementName}>
<StyledCard <StyledCard
type={type}
as={external ? 'a' : Link} as={external ? 'a' : Link}
to={external ? undefined : to} to={external ? undefined : to}
href={external ? to : undefined} href={external ? to : undefined}
target={external ? '_blank' : undefined} target={external ? '_blank' : undefined}
rel={external ? 'noopenener noreferrer' : undefined} rel={external ? 'noopenener noreferrer' : undefined}
isDarkMode={isDarkMode} $backgroundImgSrc={backgroundImgSrc}
backgroundImgSrc={backgroundImgSrc} $isDarkMode={isDarkMode}
$type={type}
> >
<TitleRow> <TitleRow>
<CardTitle>{title}</CardTitle> <CardTitle>{title}</CardTitle>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment