-
Notifications
You must be signed in to change notification settings - Fork 159
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(cta-section): web component version #4338
feat(cta-section): web component version #4338
Conversation
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.
Nice progress @IgnacioBecerra!
@@ -23,6 +23,8 @@ const { stablePrefix: ddsPrefix } = ddsSettings; | |||
* The CTA Section pattern | |||
* | |||
* @element dds-cta-section | |||
* @slot heading - The text heading. | |||
* @slot buttons - The CTA Buttons. | |||
*/ | |||
@customElement(`${ddsPrefix}-cta-section`) | |||
class DDSCTASection extends StableSelectorMixin(LitElement) { |
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.
Seems that this class should inherit DDSContentItem
.
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.
Thanks for the heads up! I'm wondering though, what are the main reasons it should inherit DDSContentItem
?
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.
Thank you for asking @IgnacioBecerra! One reason is that <dds-cta-section>
seems to do a similar thing to <dds-content-item>
, especially from the perspective of the API set. Another reason is that <CTASection>
in React renders <ContentItem>
, effectively extending <ContentItem>
via React composition pattern, whereas React composition pattern doesn't work well with Web Components: https://github.com/carbon-design-system/carbon-for-ibm-dotcom/blob/00ad9c7/packages/web-components/docs/coding-conventions.md#preferring-class-inheritance-pattern-over-react-composition-pattern
} | ||
|
||
.#{$dds-prefix}--content-block__copy { | ||
display: inline-block; | ||
font-size: 1.5rem; | ||
font-size: calc(1.25rem + 0 * ((100vw - 20rem) / 62)); |
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.
Wondering where this change comes from...?
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.
The font size change comes from the React
version, I think it was changed from 1.5rem to that calculation recently. Comes from the _cta-section.scss
under the styles
package.
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.
Great progress - Thanks @IgnacioBecerra!
packages/web-components/src/components/cta-section/__stories__/README.stories.mdx
Outdated
Show resolved
Hide resolved
packages/web-components/examples/codesandbox/components/cta-section/index.html
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/cta-section/__stories__/cta-section.stories.ts
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/cta-section/__stories__/cta-section.stories.ts
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/cta-section/__stories__/cta-section.stories.ts
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/cta-section/__tests__/cta-section.test.ts
Outdated
Show resolved
Hide resolved
Deploy preview created for package Built with commit: 75ad7e67ff8d47fb2b4c240dbdab03112ccc4b0f |
Deploy preview created for package Built with commit: 75ad7e67ff8d47fb2b4c240dbdab03112ccc4b0f |
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.
Thank you for the update @IgnacioBecerra!
packages/web-components/src/components/cta-section/cta-section-item.ts
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/cta-section/cta-section-item-heading.ts
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/cta-section/cta-section-item-copy.ts
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/cta-section/cta-section-copy.ts
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/cta-section/cta-section-item.ts
Outdated
Show resolved
Hide resolved
@asudoh Thanks for the suggestions! Now using tag selection for all the component styling. :) |
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.
LGTM 👍 - Thanks @IgnacioBecerra for all the updates!
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.
@IgnacioBecerra Several components have had content removed (looks like markdown content) in the Percy snapshots. Any idea what's going on there?
@kennylam Yeah, I noticed that last night and was about comment about it. I'm using the new Since this PR is somewhat dependent on #4351, should we wait until that one goes through before merging this one, or should I edit the stories to reflect the changes? |
@IgnacioBecerra Yes good call. That one looks ready to merge soon. We can update here and make sure all is 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.
Thank you @IgnacioBecerra for the updates and rebasing!
```html | ||
<dds-cta-section> | ||
<dds-content-block-heading>Curabitur malesuada varius mi eu posuere</dds-content-block-heading> | ||
<dds-cta-section-copy content="Lorem ipsum *dolor* sit amet"></dds-cta-section-copy> |
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.
<dds-cta-section-copy content="Lorem ipsum *dolor* sit amet"></dds-cta-section-copy> | |
<dds-cta-section-copy>Lorem ipsum *dolor* sit amet</dds-cta-section-copy> |
## Props | ||
|
||
<Props of="dds-cta-section" /> | ||
|
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.
<Description markdown={markdownContents} /> |
@@ -0,0 +1,60 @@ | |||
import { Props, Description } from '@storybook/addon-docs/blocks'; | |||
import contributing from '../../../../../../docs/contributing-license.md'; | |||
|
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.
import markdownContents from '../../../../docs/markdown-contents.md'; | |
<div class="bx--col-sm-4 bx-col-lg-12 bx--offset-lg-4"> | ||
<dds-cta-section> | ||
<dds-content-block-heading>Curabitur malesuada varius mi eu posuere</dds-content-block-heading> | ||
<dds-cta-section-copy content=${ifNonNull(copy)}></dds-cta-section-copy> |
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.
<dds-cta-section-copy content=${ifNonNull(copy)}></dds-cta-section-copy> | |
<dds-cta-section-copy>Want to discuss your options with a DevOps expert? Contact our sales team to evaluate your needs.</dds-cta-section-copy> |
<dds-cta-section-item-copy | ||
>IBM DevOps partners have a wide range of expertise. Find one to build the right solution for you." | ||
</dds-cta-section-item-copy> |
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.
<dds-cta-section-item-copy | |
>IBM DevOps partners have a wide range of expertise. Find one to build the right solution for you." | |
</dds-cta-section-item-copy> | |
<dds-cta-section-item-copy | |
>IBM DevOps partners have a wide range of expertise. Find one to build the right solution for you.</dds-cta-section-item-copy> |
return html` | ||
<dds-cta-section> | ||
<dds-content-block-heading>${ifNonNull(heading)}</dds-content-block-heading> | ||
<dds-cta-section-copy content=${ifNonNull(copy)}></dds-cta-section-copy> |
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.
<dds-cta-section-copy content=${ifNonNull(copy)}></dds-cta-section-copy> | |
<dds-cta-section-copy>ifNonNull(copy)</dds-cta-section-copy> |
@asudoh Thanks for catching those! Updated with new component usage. |
Cool thanks @IgnacioBecerra for the update! |
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.
LGTM!
Related Ticket(s)
#3749
#3368
Description
Introducing the
<dds-cta-section>
component for Web Components, featuring Footer variations with Content Items and a Link List.Default:
Content Items Footer:
Link List Footer:
Changelog
New
<dds-cta-section>
component<dds-cta-section-item>
component to wrap<dds-cta-section-heading>
and<dds-cta-section-copy>
with the correct styling