Skip to content

feat: create MediaBanner component#582

Open
aquelemiguel wants to merge 23 commits intomainfrom
dls-595
Open

feat: create MediaBanner component#582
aquelemiguel wants to merge 23 commits intomainfrom
dls-595

Conversation

@aquelemiguel
Copy link
Contributor

@aquelemiguel aquelemiguel commented Mar 19, 2026

Closes DLS-595.

@vercel
Copy link

vercel bot commented Mar 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ldls Ready Ready Preview, Comment Mar 20, 2026 4:58pm
ldls-react-native Ready Ready Preview, Comment Mar 20, 2026 4:58pm

Request Review

Copy link
Collaborator

@zel-kass zel-kass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last question, I see that react's version is missing its Figma code connect. Is that intentional ?

iconType='stroked'
className='absolute top-8 right-8'
onClick={() => onClose()}
aria-label={t('components.banner.closeAriaLabel')}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[mid]: In the MediaCard pull request, I introduced a streamlined key common.closeAriaLabel. You might want to use it here, and to align with Abla's previous ContentBanner implementation, you could also add 'closeAriaLabel' prop and do something like aria-label={closeAriaLabel || t('common.closeAriaLabel')}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, but I kinda dislike the closeAriaLabel prop. I think it's too trivial for consumers to wanna want to edit it. Keen on keeping our component props a bit leaner. Regarding the translation key, keeping the "banner subdomain" as it's the standard in other banners, but I like your initiative.

<div className='flex flex-col gap-4 py-12'>{children}</div>
</div>
<div className='relative w-128'>
<img
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[mid]: Right now, if the imageUrl is broken or isn't provided, nothing prevents from breaking and showing :

Image

That is something we don't want. you could either handle that with a useState that is controlled by onLoad and onError, adding some style to hide the failing image. Or conditionally render the image with this state and put a useEffect with the imageUrl in dependencies. Finally, I would also probably conditionally render the gradient overlay based on this state. The var would look something like const showImage = imageUrl && !imageLoadError

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice idea. I'm assuming we keep imageUrl required as this is a ~media~ banner, but we gracefully hide the broken image and show a fallback flat color? I'm also not keen on hiding the gradient as it highlights the close icon regardless. Lastly I have no idea what's wrong with that gradient in the screenshot, must've gotten something the other way around. Will check with Laurine about the fallback.

* The banner content (MediaBannerTitle, MediaBannerDescription).
*/
children: ReactNode;
} & Omit<ComponentPropsWithRef<'div'>, 'children'>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low]: Not sure omitting children here is necessary. From what I remember, ComponentPropsWithRef<'div'> already includes children?: ReactNode. If the intent was to make the children mandatory, in this kind of intersection, the result will be required. So no need to Omit, unless I missed something ? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point was to make it mandatory, yeah. And you're right that ComponentPropsWithRef provides optional children, so extending but omitting children allows the required override to stay, no? Doesn't get replaced by the optional default one.

},
closeButton: {
position: 'absolute',
top: 8.5,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low]: You put 8px on react's version, I see on Figma that 8.5 is the reference value. More of a question, do we want to have 1:1 alignment with designs, or do we prefer using our tokens and streamline both implems ?

Copy link
Contributor Author

@aquelemiguel aquelemiguel Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice spot! TBF that half-pixel is bugging me hard. I'd just do 8px with token for both. Opinion?

);

return (
<Pressable lx={lx} style={[styles.container, style]} {...props}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low]: since no action is attached to the MediaBanner, why did you wrap in a Pressable instead of a Box ?

Copy link
Contributor Author

@aquelemiguel aquelemiguel Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right to raise this, IMO it felt natural for a banner to provide a press handler. Wouldn't surprise me if this was requested down the line. Other apps like Kraken do it, for instance. Did so as a nice-to-have which should not affect functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants