Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(CoverHero): new component #1144

Merged
merged 22 commits into from
Jun 18, 2024
Merged

feat(CoverHero): new component #1144

merged 22 commits into from
Jun 18, 2024

Conversation

atabel
Copy link
Collaborator

@atabel atabel commented Jun 10, 2024

Copy link

github-actions bot commented Jun 10, 2024

Size stats

master this branch diff
Total JS 10.7 MB 10.7 MB +12.9 kB
JS without icons 1.95 MB 1.97 MB +12.8 kB
Lib overhead 53.8 kB 53.8 kB 0 B
Lib overhead (gzip) 14.4 kB 14.4 kB 0 B

Copy link

github-actions bot commented Jun 10, 2024

Accessibility report
✔️ No issues found

ℹ️ You can run this locally by executing yarn audit-accessibility.

Copy link

github-actions bot commented Jun 10, 2024

Deploy preview for mistica-web ready!

✅ Preview
https://mistica-k8hxoi6ga-flows-projects-65bb050e.vercel.app

Built with commit d465585.
This pull request is being automatically deployed with vercel-action

@@ -27,7 +27,6 @@ export const image = style([
borderRadius: skinVars.borderRadii.container,
}),
{
zIndex: 1,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know why we had this, but removing it didn't break any screenshot test (also tested in webapp)

@@ -0,0 +1,35 @@
'use client';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

extracted this part to a different file because it's te interactive part of the component, hence we need "use client". This way the rest of the component is a RSC and will not contribute to bundle size in the browser.

left,
right,
verticalSpace,
collapseBreakpoint = 'tablet',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this prop is new, this will allow configuring GridLayout to collapse in mobile breackpoint instead of tablet (default behaviour). This mode is required in CoverHero

@atabel atabel marked this pull request as ready for review June 10, 2024 14:47
default: vars.colors.background,
inverse: vars.colors.backgroundBrand,
alternative: vars.colors.backgroundAlternative,
}[variant ?? 'default'];
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not how we handle variants in Mistica. For example, this playroom looks weird to me. All the other components read the variant from the context

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no, you have to distinguish between components that a adapt to external variant and components that sets the variant. For example, a button or a text component adapt the colors depending on the external variant context, but Hero, Header or some Cards can set their own variant

minHeight: aspectRatio && aspectRatio !== 'auto' ? 'auto' : minHeight,
boxSizing: 'border-box',
background,
aspectRatio: aspectRatioToCssString(aspectRatio),
Copy link
Collaborator

Choose a reason for hiding this comment

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

aspectRatio is not supported by all the Chrome versions we need: https://caniuse.com/?search=aspect-ratio

Why not using AspectRatioContainer (doing something similar to what we do with cards)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wanted to avoid the paddingTop hack because this is a rare case in this component and the graceful degradation for old browsers is quite good here.
Anyway, I finally included the hack, although I needed an extra div :(

src/grid-layout.tsx Outdated Show resolved Hide resolved
@@ -282,11 +282,14 @@ const CardActionPauseIcon = ({color}: IconProps) => <IconPauseFilled color={colo

const CardActionPlayIcon = ({color}: IconProps) => <IconPlayFilled color={color} size={12} />;

const useVideoWithControls = (
export const useVideoWithControls = (
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we abstract this in a separate file instead? It's not something specific to cards anymore

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes I thought about it, I can extract it if you prefer

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I think we should do it in order to keep the code well organized

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we could create a top-actions.tsx file with all the top actions components/hooks including this one, what do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

talked offline, we'll move this refactor to the future (when we have over media variant)

src/cover-hero.tsx Show resolved Hide resolved
src/__stories__/cover-hero-story.tsx Outdated Show resolved Hide resolved
src/__stories__/cover-hero-story.tsx Show resolved Hide resolved
src/cover-hero.tsx Show resolved Hide resolved
src/cover-hero.tsx Show resolved Hide resolved
Copy link
Contributor

@aweell aweell left a comment

Choose a reason for hiding this comment

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

The lenght of the description changes in desktop when there's a side slot depending if centered is true|false, the expected lenght should be the same is if was left aligned.

Example

<Box paddingY={noPaddingY ? 0 : {desktop: 56, tablet: 56, mobile: 24}}>
<Stack space={24}>
{centered && !sideExtra ? (
mainContent
Copy link
Contributor

Choose a reason for hiding this comment

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

When centered in desktop seems that there's no limitation for the title, pretitle and description width.

Same as left aligned the content should take:

Pretitle: 6col (or that 75%)
Title: 8col
Description: 6col (or that 75%)

Screenshot 2024-06-11 at 18 10 37

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

options: ['default', 'inverse', 'alternative'],
control: {type: 'select'},
// this control should only be visible when background is set to 'color from skin' or 'custom color'
// if: {arg: 'background', eq: 'color'},
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a missing storybook feature. I can configure the variant control to appear when background is 'color from skin': if: {arg: 'background', eq: 'color from skin'} but I can't configure it to appear when background is 'color from skin' or 'custom color'

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, it's a very annoying thing from Storybook, but why leaving this commented line? I'd remove it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just to document the intention, but I can remove it

Copy link
Collaborator Author

@atabel atabel Jun 18, 2024

Choose a reason for hiding this comment

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

I've rewritten the comment with a better explanation and added a reference to this PR: ComponentDriven/csf#76

Copy link
Contributor

@yceballost yceballost left a comment

Choose a reason for hiding this comment

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

🙌

@atabel atabel added this pull request to the merge queue Jun 18, 2024
Merged via the queue into master with commit a655e6e Jun 18, 2024
11 checks passed
@atabel atabel deleted the atoledano-cover-hero branch June 18, 2024 12:15
tuentisre pushed a commit that referenced this pull request Jun 19, 2024
# [15.11.0](v15.10.0...v15.11.0) (2024-06-19)

### Bug Fixes

* **ButtonLayout:** add bleed when using only link ([#1150](#1150)) ([554f98a](554f98a))
* **Counter:** add aria-live to value ([#1146](#1146)) ([3e2e09b](3e2e09b))
* **Header:** bleed not working in o2-new skin ([#1137](#1137)) ([00fb632](00fb632))
* **MainNavigationBar:** remove logo space in mobile when no sections are given ([#1149](#1149)) ([e4c03a0](e4c03a0))
* **Select:** set text color in native version ([#1141](#1141)) ([eedf265](eedf265))
* **Spinner:** use controlActivatedInverse token as default when used inside inverse variant ([#1133](#1133)) ([38a192d](38a192d))

### Features

* **Cards:** improve accessibility ([#1139](#1139)) ([dde9cc5](dde9cc5))
* **Chip:** allow using badge in selectable chips ([#1134](#1134)) ([9ecda7c](9ecda7c))
* **Circle:** custom background support ([#1136](#1136)) ([bedeaa4](bedeaa4))
* **CoverHero:** new component ([#1144](#1144)) ([a655e6e](a655e6e))
* **DisplayMediaCard, PosterCard:** add extra ([#1131](#1131)) ([501cf73](501cf73))
* **EmptyState:** allow using only ButtonLink as action ([#1140](#1140)) ([d73c219](d73c219))
* **HighlightedCard:** support for alt for image ([#1135](#1135)) ([c9ba728](c9ba728))
* **Image:** Custom fallback icon in Vivo New ([#1145](#1145)) ([ec600fe](ec600fe))
* **Switch:** Improve animation ([#1142](#1142)) ([8162eed](8162eed))
* **Table:** new component ([#1129](#1129)) ([328e013](328e013))
* **Timer:** create component ([#1130](#1130)) ([0b3253e](0b3253e))
* **Touchable:** newTab support in to links ([#1143](#1143)) ([eff07e3](eff07e3))
@tuentisre
Copy link
Collaborator

🎉 This PR is included in version 15.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants