message: feat(component): updated to switch case and made few changes
diff: @@ -22,63 +22,53 @@ import React from 'react';
  * @returns {*} CTA Component
  */
  const CTA = ({ style, type, ...cta }) => {
  - if (style === 'card') {
  - if (type === 'jump') {
  + switch (style) {
  + case 'card':
  return (
  <CardLink
  {...cta}
  icon={iconSelector(type)}
  - onClick={e => {
  - handleOnClick(e, cta.id);
  - }}
  - />
  - );
  + onClick={
  + type === 'jump'
  + ? e => {
  + smoothScrolling(e, cta.id);
  }
  - return <CardLink {...cta} icon={iconSelector(type)} />;
  + : null
  }
  - if (style === 'button') {
  - if (type === 'jump') {
  + />
  + );
  + case 'button':
  return (
  <ButtonGroup
  buttons={renderButtons(cta)}
  - onClick={e => {
  - handleOnClick(e, cta.id);
  - }}
  - />
  - );
  + onClick={
  + type === 'jump'
  + ? e => {
  + smoothScrolling(e, cta.id);
  }
  - return <ButtonGroup buttons={renderButtons(cta)} />;
  + : null
  }
  - if (style === 'feature') {
  + />
  + );
  + case 'feature':
  return <FeaturedLink {...cta} />;
  - }
  - if (style === 'text') {
  - if (type === 'jump') {
  + default:
  return (
  <LinkWithIcon
  href={cta.href}
  - onClick={e => {
  - handleOnClick(e, cta.id);
  - }}>
  - {cta.copy}
  - {iconSelector(type)}
  - </LinkWithIcon>
  - );
  - } else if (type === 'external') {
  - return (
  - <LinkWithIcon href={cta.href} target="_blank">
  - {cta.copy}
  - {iconSelector(type)}
  - </LinkWithIcon>
  - );
  - }
  + target={type === 'external' ? '_blank' : null}
  + onClick={
  + type === 'jump'
  + ? e => {
  + smoothScrolling(e, cta.id);
  }
  - return (
  - <LinkWithIcon href={cta.href}>
  + : null
  + }>
  {cta.copy}
  {iconSelector(type)}
  </LinkWithIcon>
  );
  + }
  };
  /**
  @@ -87,7 +77,7 @@ const CTA = ({ style, type, ...cta }) => {
  * @param {*} e event object
  * @param {*} id element id
  */
  -const handleOnClick = (e, id) => {
  +const smoothScrolling = (e, id) => {
  e.preventDefault();
  document.querySelector(`[id="${id}"]`).scrollIntoView({
  behavior: 'smooth',
  