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(cxl-ui): cxl-featured-image add component #413

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

anoblet
Copy link
Collaborator

@anoblet anoblet commented May 15, 2024

@anoblet anoblet requested review from lkraav and pawelkmpt May 15, 2024 17:50
Copy link

github-actions bot commented May 15, 2024

size-limit report 📦

Path Size
packages/cxl-ui/pkg/dist-web/cxl-ui.js 44.2 KB (+1.15% 🔺)
packages/cxl-ui/pkg/dist-web/cxl-ui-jwplayer.js 11.89 KB (0%)
packages/cxl-ui/pkg/dist-web/cxl-ui-playbooks.js 28.99 KB (0%)
packages/cxl-ui/pkg/dist-web/vendor.js 138.23 KB (0%)
packages/cxl-ui/pkg/dist-web/cxl-ui-institute.js, packages/cxl-ui/pkg/dist-web/cxl-ui-jwplayer.js, packages/cxl-ui/pkg/dist-web/cxl-ui-playbooks.js, packages/cxl-ui/pkg/dist-web/cxl-ui.js, packages/cxl-ui/pkg/dist-web/manifest.js, packages/cxl-ui/pkg/dist-web/unresolved.js, packages/cxl-ui/pkg/dist-web/vendor.js 275.8 KB (+0.19% 🔺)

packages/cxl-ui/scss/cxl-featured-image.scss Show resolved Hide resolved
:host {
position: relative;
display: block;
min-width: 360px;

Choose a reason for hiding this comment

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

Suggested change
min-width: 360px;
min-width: 320px;

At the same time I'm wondering whether it even needs min-width. It's block element which means it's 100% wide by default. And on screens smaller than 360 it causes horizontal scrollbar.

Copy link
Collaborator Author

@anoblet anoblet May 16, 2024

Choose a reason for hiding this comment

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

Since the element technically doesn't have any content(only a background), without setting a minimum width, it collapses to 0.

@pawelkmpt
Copy link

One more thing, it should be visible on mobile only. Now question is whether it's better to encapsulate visibility inside the component or control it with external CSS. I don't know the answer yet

@anoblet
Copy link
Collaborator Author

anoblet commented May 16, 2024

One more thing, it should be visible on mobile only. Now question is whether it's better to encapsulate visibility inside the component or control it with external CSS. I don't know the answer yet

The correct way would be to do it from the outside, though it wouldn't be a big deal taking a shortcut here.

@anoblet anoblet requested a review from pawelkmpt May 16, 2024 14:13
:host {
position: relative;
display: block;
min-width: 320px;

Choose a reason for hiding this comment

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

I'm thinking min-width is unnecessary. At least component placed on the real WP page looks good without it.

Screenshot 2024-06-13 at 10 57 39

bottom: 0;
width: 100%;
height: 75%;
background-color: var(--cxl-featured-image-bg-color, var(--cxl-brand-color-black, rgb(26, 26, 26)));

Choose a reason for hiding this comment

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

We do not have --cxl-featured-image-bg-color defined anywhere so component background color is not compatible with what we see on the desktop.

What about refactoring this code:

:host(.wide-background-black) {
&::before {
background-color: var(--cxl-brand-color-black);
}
}
:host(.wide-background-red) {
&::before {
background-color: var(--lumo-primary-color);
}
}
:host(.wide-background-blue) {
&::before {
background-color: var(--cxl-brand-color-blue);
}
}
:host(.wide-background-light-blue) {
&::before {
background-color: var(--cxl-brand-color-light-blue);
}
}
:host(.wide-background-green) {
&::before {
background-color: var(--cxl-brand-color-green);
}
}

We could set variable value instead of explicit background color value. Doable @anoblet?

@pawelkmpt
Copy link

One more thing needed

export { CXLFeaturedImage } from './components/cxl-featured-image';

@anoblet
Copy link
Collaborator Author

anoblet commented Jun 13, 2024

  • Added export
  • Kept min-width since without it, the component won't show in Storybook(Let me know if we really want to remove it)
  • Set a default image source
  • Added media query to hide on desktop
  • Added class based background color system( ). Let me know if this is the correct strategy.

@anoblet anoblet requested a review from pawelkmpt June 13, 2024 14:08
Copy link

@pawelkmpt pawelkmpt left a comment

Choose a reason for hiding this comment

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

Good approach. Just two things to fix. Please also squash all commits into one


:host(.red) {
#container {
background-color: var(--cxl-brand-color-red);

Choose a reason for hiding this comment

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

Suggested change
background-color: var(--cxl-brand-color-red);
background-color: var(--lumo-primary-color);
Screenshot 2024-06-13 at 21 40 51

Comment on lines 8 to 9
@property({ type: String }) src =
'https://ebpyu8ye7bj.exactdn.com/institute/wp-content/uploads/2023/12/ben-labay_team_headshot-1x1-bw-min-fix-min-compressed.png?strip=all&lossy=1&fit=720%2C720&ssl=1';

Choose a reason for hiding this comment

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

No need to set default image. Especially with such URL. Keep it empty.

@anoblet anoblet force-pushed the anoblet/feat/featured-image branch from fa456ce to ac0ca62 Compare June 13, 2024 21:15
@anoblet anoblet requested a review from pawelkmpt June 13, 2024 21:15
@pawelkmpt pawelkmpt force-pushed the anoblet/feat/featured-image branch from ac0ca62 to b3de6c6 Compare June 20, 2024 04:15
@pawelkmpt pawelkmpt merged commit d0a004e into master Jun 21, 2024
5 checks passed
@pawelkmpt pawelkmpt deleted the anoblet/feat/featured-image branch June 21, 2024 09:04
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