// Who's Who: the club's key contacts. Its own page (#whos-who), under
// Our Club in the nav. Edit KEY_CONTACTS to change names, roles or emails; leave
// email out for anyone without one.
// ---------------------------------------------------------------------------

const KEY_CONTACTS = [
  { name: 'Oliver Perkins', role: 'Director', email: 'oliverperkins@blackpoolwrenrovers.co.uk' },
  { name: 'Mark Watkins', role: 'Director', email: 'markwatkins@blackpoolwrenrovers.co.uk' },
  { name: 'Alan Lowe', role: 'Head of Club Operations & Club Secretary', email: 'secretary@blackpoolwrenrovers.co.uk' },
  { name: 'Lee Sharples', role: 'General Manager' },
  { name: 'Lisa Dentith', role: 'Treasurer', email: 'treasurer@blackpoolwrenrovers.co.uk' },
];

const initialsOf = (name) => name.split(/\s+/).map(w => w[0]).join('').slice(0, 2).toUpperCase();

const ContactCard = ({ c }) => (
  <div className="who__card">
    <div className="who__top">
      <div className="display who__initials" aria-hidden="true">{initialsOf(c.name)}</div>
      <div>
        <div className="display who__name">{c.name}</div>
        <div className="mono who__role">{c.role}</div>
      </div>
    </div>
    {c.email
      ? <a className="who__email" href={'mailto:' + c.email}>{c.email}</a>
      : <span className="who__email who__email--none">Speak to Lee at the club</span>}
  </div>
);

const WhosWho = () => (
  <section id="whos-who" style={{ background: 'var(--paper)', padding: '64px 0 96px' }}>
    <div className="container">
      <SectionHead kicker="Who's Who" title="Key contacts."
        right={<p style={{ maxWidth: 380, margin: 0, color: 'var(--muted)', fontSize: 14, lineHeight: 1.55 }}>
          The people who run the club day to day. Drop the right person an email and they'll get back to you.
        </p>} />
      <div className="who__grid">
        {KEY_CONTACTS.map(c => <ContactCard key={c.name} c={c} />)}
      </div>
    </div>
  </section>
);

Object.assign(window, { WhosWho, KEY_CONTACTS });
