import React from 'react';
import PropTypes from 'prop-types';
import LazyImage from '../../../../../hooks/lazy-image';
import Link from '../../../../../hooks/link';
import { imagePrettyUrl } from '../../../../../helpers/getters.mjs';
import styles from './template-one.module.scss';

export default function TemplateOne({ module }) {
  const { items } = module;
  return (
    <div className={styles?.spotlightsImage || ''}>
      {
        // eslint-disable-next-line react/prop-types
        items?.map((res) => (
          <Link to={res?.link?.value} external={res?.link?.type === 'external'}>
            {res?.image && (
              <LazyImage
                width={295}
                height={260}
                src={imagePrettyUrl(res?.image)}
                alt={res?.link_text}
              />
            )}
            {/* Need to talk to add this field on hercules */}
            <p>{res?.link_text}Top Online Casinos</p>
            {res.subtitle && <span>{res.subtitle}</span>}
          </Link>
        ))
      }
    </div>
  );
}

TemplateOne.propTypes = {
  module: PropTypes.shape({
    items: PropTypes.shape({}),
  }).isRequired,
};
