Go to the homepage
Powered bySitecore Search logo
Skip to main contentThe Sitecore Accelerate for partners page has loaded.

Sitecore Accelerate for partners

Only Export Components that are used by content authors

Only Export Components that are used by content authors

import React from 'react'; import { Image as JssImage, Link as JssLink, RichText as JssRichText, ImageField, Field, LinkField } from '@sitecore-jss/sitecore-jss-nextjs'; interface Fields { PromoIcon: ImageField; PromoText: Field<string>; PromoLink: LinkField; PromoText2: Field<string>; } type PromoProps = { params: { [key: string]: string }; fields: Fields; }; const PromoDefaultComponent = (props: PromoProps): JSX.Element => ( <div className={`component promo ${props.params.styles}`}> <div className="component-content"> <span className="is-empty-hint">Promo</span> </div> </div> ); const LinkButton = (props: PromoProps): JSX.Element => { return ( <div className="field-promolink"> <JssLink field={props.fields.PromoLink} /> </div> ); }; export const Default = (props: PromoProps): React.JSX.Element => { const id = props.params.RenderingIdentifier; if (props.fields) { return ( <div className={`component promo ${props.params.styles}`} id={id ? id : undefined}> <div className="component-content"> <div className="field-promoicon"> <JssImage field={props.fields.PromoIcon} /> </div> <div className="promo-text"> <div> <div className="field-promotext"> <JssRichText field={props.fields.PromoText} /> </div> </div> <LinkButton {...props} /> </div> </div> </div> ); } return <PromoDefaultComponent {...props} />; }; export const WithText = (props: PromoProps): JSX.Element => { const id = props.params.RenderingIdentifier; if (props.fields) { return ( <div className={`component promo ${props.params.styles}`} id={id ? id : undefined}> <div className="component-content"> <div className="field-promoicon"> <JssImage field={props.fields.PromoIcon} /> </div> <div className="promo-text"> <div> <div className="field-promotext"> <JssRichText className="promo-text" field={props.fields.PromoText} /> </div> </div> <div className="field-promotext"> <JssRichText className="promo-text" field={props.fields.PromoText2} /> </div> <LinkButton {...props} /> </div> </div> </div> ); } return <PromoDefaultComponent {...props} />; };

© Copyright 2024, Sitecore. All Rights Reserved