Hello!
Would someone be able to assist me in passing the final check of Module Assessment 13? →
“Add a new helparticle card and update the data mappings”"
I am apparently failing this, but as far as I can see in my preview, all the changes through the challenge look like they are correctly reflected.
My component.js file looks like the following:
{{> cards/card_component componentName=‘helparticle’ }}
class helparticleCardComponent extends BaseCard['helparticle'] {
constructor(config = {}, systemConfig = {}) {
super(config, systemConfig);
}
/**
* This returns an object that will be called `card`
* in the template. Put all mapping logic here.
*
* @param profile profile of the entity in the card
*/
dataForRender(profile) {
return {
title: profile.name, // The header text of the card
url: profile.website || profile.landingPageUrl, // If the card title is a clickable link, set URL here
target: '_top', // If the title's URL should open in a new tab, etc.
// image: '', // The URL of the image to display on the card
// altText: '', // The alternate text for the image
titleEventOptions: this.addDefaultEventOptions(),
subtitle: Formatter.joinList(profile.keywords), // The sub-header text of the card
details: profile.s_snippet, // The text in the body of the card
// If the card's details are longer than a certain character count, you can truncate the
// text. A toggle will be supplied that can show or hide the truncated text.
showMoreDetails: {
showMoreLimit: 750, // Character count limit
showMoreText: 'Show more', // Label when toggle will show truncated text
showLessText: 'Show less' // Label when toggle will hide truncated text
},
// The primary CTA of the card
CTA1: {
label: profile.c_primaryCTA ? profile.c_primaryCTA.label : null, // The CTA's label
iconName: 'chevron', // The icon to use for the CTA
url: Formatter.generateCTAFieldTypeLink(profile.c_primaryCTA), // The URL a user will be directed to when clicking
target: '_top', // Where the new URL will be opened
eventType: 'CTA_CLICK', // Type of Analytics event fired when clicking the CTA
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: '', // Accessible text providing a descriptive label for the CTA
},
// The secondary CTA of the card
CTA2: {
label: profile.c_secondaryCTA ? profile.c_secondaryCTA.label : null,
iconName: 'chevron',
url: Formatter.generateCTAFieldTypeLink(profile.c_secondaryCTA),
target: '_top',
eventType: 'CTA_CLICK',
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: '',
}
};
}
/**
* The template to render
* @returns {string}
* @override
*/
static defaultTemplateName (config) {
return 'cards/helparticle';
}
}
ANSWERS.registerTemplate(
'cards/helparticle',
{{{stringifyPartial (read 'cards/helparticle/template') }}}
);
ANSWERS.registerComponentType(helparticleCardComponent);
Any assistance would be greatly appreciated!
Many thanks,
Arisa