-
Notifications
You must be signed in to change notification settings - Fork 4
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
CED-721 Add EsCta component #1039
Conversation
β
Β Linked to Task CED-721 Β· EsVerticalCTA Component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a quick pass at things, overall looks good. I'll take a deeper dive into things a little later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RyanMulready these seem like environment/package issues:
Importing from @energysage/es-vue-base in EsCta.vue doesn't work (it says the module path can't be resolved.)
When inside es-vue-base
self imports should be treated like any other project:
import {
formMixins,
} from '../lib-mixins';
import {
vuelidateMinLength,
vuelidateMaxLength,
vuelidateNumeric,
vuelidateRequired,
} from '../lib-validators';
Container queries don't seem to work in EsCta.vue even though they work in es-cta.vue. I also see scss warnings in the code that the container-* properties are unknown.
I don't see any errors/warnings. Can you show me what they say and/or maybe point at a specific container style that isn't working as expected?
@RyanMulready, thanks, I had a brain blip with the imports. Here's what I'm talking about (click to expand). The PR has been updated to demo this as well. |
I do not see those warnings myself. I haven't actually used containers yet, they are relatively new. However I think you might be using @container card (min-width: 600px) {
.flex-layout-outer {
display: flex;
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to make a few suggestions that will hopefully simplify things and make this easier to reason about:
- EsCta should probably be an organism rather than a molecule, because it's made up of a bunch of molecules.
- I recognize Ryan specified the props a certain way in the ticket, however I feel pretty strongly that we should pull the zip code form functionality out into its own organism component, EsZipCodeForm (very similar to the PageZipCodeForm component in
es-cms-pages
). We can still do that as part of this ticket and PR.- EsCta can then take a
<slot name="cta" />
and on the docs page, we can show a few examples of what you could pass in there - either nothing (for case of the cross-sell card), or a button, or EsZipCodeForm. - This would greatly reduce the number of props coming into this component, which would reduce the risk of unexpected interactions between them (e.g.
showForm
beingtrue
butshowZipEntry
beingfalse
), as well as make the zip code form logic easier to reason about.
- EsCta can then take a
- I think we should also separate the full-width banners from the card-like ones that will always live within a constrained column width on a page.
- I think it'll be too difficult to ensure the layout works if we mix these two use cases into one component. The full-width banners never have an image or supporting text, so making the side-by-side layout work in cases where people happen to add those in is a waste of time. The cards never change layout - their contents are always vertically stacked, and their parent layouts will set them up in a column grid layout so they never grow too wide.
- This may mean we don't need container queries anymore - sounds like they were difficult to get working correctly anyway?
- The card one could be called something like EsCtaCard, and the full-page-width one could be called EsCtaBanner.
- The image should probably be implemented as a
<slot name="image">
so we can use StoryblokImage if we need to. It could still have a default<b-img>
inside it and take props likeimageSrc
andimageAlt
like EsSupportCard does, but we'll probably end up passing StoryblokImage into the slot in all cases anyway to avoid CLS.
In HTML5 pretty much everything can be nested inside an anchor-tag (including block-level elements), with the exception of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified the components a bit, removed props I don't think we need to match the designs, converted several text props to slots, added more robust docs and examples.
π Linked issue
https://energysage.atlassian.net/browse/CED-721
β Type of change
π Description
EsCta
component which can be customized for the different use cases described in the ticket.Feedback requested/issues:
@energysage/es-vue-base
inEsCta.vue
doesn't work (it says the module path can't be resolved.) Importing from../..
gets rid of warnings in VSCode, but also fails to build.EsCta.vue
even though they work ines-cta.vue
. I also see scss warnings in the code that thecontainer-*
properties are unknown.showForm
isfalse
, I use the whole card as a link. Is that bad, because it's putting block components in an inline component? Should I use@click
instead and change thewindow.location.href
?showForm
istrue
butshowZipEntry
isfalse
, clicking the button takes you to the destination URL with a "?" appended. Is this bad, and should I find some way to prevent that when the form submits?π₯Ό Testing
π Checklist