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

Removed unnecessary constructor in CallToActionNode #1432

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,7 @@ export class CallToActionNode extends generateDecoratorNode({nodeType: 'call-to-
{name: 'imageUrl', default: ''}
]}
) {
/* override */
constructor({
layout,
textValue,
showButton,
buttonText,
buttonUrl,
buttonColor,
buttonTextColor,
hasSponsorLabel,
backgroundColor,
hasImage,
imageUrl
} = {}, key) {
super(key);
this.__layout = layout ?? 'minimal';
this.__textValue = textValue ?? '';
this.__showButton = showButton ?? false;
this.__buttonText = buttonText ?? '';
this.__buttonUrl = buttonUrl ?? '';
this.__buttonColor = buttonColor ?? 'none';
this.__buttonTextColor = buttonTextColor ?? 'none';
this.__hasSponsorLabel = hasSponsorLabel ?? true;
this.__backgroundColor = backgroundColor ?? 'grey';
this.__hasImage = hasImage ?? false;
this.__imageUrl = imageUrl ?? '';
}
/* overrides */
}

export const $createCallToActionNode = (dataset) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/kg-default-nodes/test/nodes/call-to-action.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ describe('CallToActionNode', function () {
callToActionNode.buttonUrl = 'http://blog.com/post1';
callToActionNode.buttonUrl.should.equal('http://blog.com/post1');

callToActionNode.buttonColor.should.equal('none');
callToActionNode.buttonColor.should.equal('');
callToActionNode.buttonColor = 'red';
callToActionNode.buttonColor.should.equal('red');

callToActionNode.buttonTextColor.should.equal('none');
callToActionNode.buttonTextColor.should.equal('');
callToActionNode.buttonTextColor = 'black';
callToActionNode.buttonTextColor.should.equal('black');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ const Template = ({display, value, ...args}) => {
<div>
<div className="kg-prose">
<div className="mx-auto my-8 min-w-[initial] max-w-[740px]">
<CardWrapper
<CardWrapper
IndicatorIcon={VisibilityIndicatorIcon}
indicatorPosition={{
top: '1.2rem'
}}
{...(args.color === 'none' && {wrapperStyle: 'wide'})}
{...display}
{...(args.color === '' && {wrapperStyle: 'wide'})}
{...display}
{...args}
>
<CtaCard {...display} {...args} htmlEditor={htmlEditor} />
Expand All @@ -77,10 +77,10 @@ const Template = ({display, value, ...args}) => {
</div>
{/* <div className="kg-prose dark bg-black px-4 py-8">
<div className="mx-auto my-8 min-w-[initial] max-w-[740px]">
<CardWrapper
IndicatorIcon={VisibilityIndicatorIcon}
{...(args.color === 'none' && {wrapperStyle: 'wide'})}
{...display}
<CardWrapper
IndicatorIcon={VisibilityIndicatorIcon}
{...(args.color === 'none' && {wrapperStyle: 'wide'})}
{...display}
{...args}
>
<CtaCard {...display} {...args} htmlEditor={htmlEditor} />
Expand Down
2 changes: 1 addition & 1 deletion packages/koenig-lexical/src/nodes/CallToActionNode.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class CallToActionNode extends BaseCallToActionNode {
return (
<KoenigCardWrapper
nodeKey={this.getKey()}
wrapperStyle={this.backgroundColor === 'none' ? 'wide' : 'regular'}
wrapperStyle={this.backgroundColor ? 'regular' : 'wide'}
>
<CallToActionNodeComponent
backgroundColor={this.backgroundColor}
Expand Down
Loading