Skip to content

Commit

Permalink
refactor sublink rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
abeddow91 committed Sep 17, 2024
1 parent 0898a19 commit 807309d
Showing 1 changed file with 6 additions and 28 deletions.
34 changes: 6 additions & 28 deletions dotcom-rendering/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -420,19 +420,8 @@ export const Card = ({
/>
);
}
if (isFlexibleContainer) {
return (
<Hide from="tablet">
<SupportingContent
supportingContent={supportingContent}
containerPalette={containerPalette}
alignment={supportingContentAlignment}
/>
</Hide>
);
}
return (
<Hide from="desktop">
<Hide from={isFlexibleContainer ? 'tablet' : 'desktop'}>
<SupportingContent
supportingContent={supportingContent}
containerPalette={containerPalette}
Expand All @@ -445,22 +434,8 @@ export const Card = ({
const decideInnerSublinks = () => {
if (!hasSublinks) return null;
if (sublinkPosition !== 'inner') return null;
if (isFlexibleContainer) {
return (
<Hide until="tablet">
<SupportingContent
supportingContent={supportingContent}
alignment={
'vertical'
} /* inner links are always vertically stacked */
containerPalette={containerPalette}
/>
</Hide>
);
}

return (
<Hide until="desktop">
<Hide until={isFlexibleContainer ? 'tablet' : 'desktop'}>
<SupportingContent
supportingContent={supportingContent}
alignment={
Expand Down Expand Up @@ -776,7 +751,10 @@ export const Card = ({
)}
{sublinkPosition === 'outer' &&
supportingContentAlignment === 'horizontal' &&
imageSize !== 'jumbo' && <HorizontalDivider />}
(imagePositionOnDesktop === 'right' ||
imagePositionOnDesktop === 'left') && (
<HorizontalDivider />
)}
</div>

{/* This div is needed to push this content to the bottom of the card */}
Expand Down

0 comments on commit 807309d

Please sign in to comment.