summaryrefslogtreecommitdiff
path: root/src/components/Scotsoun.astro
blob: c1d8fdfff8ba5f9e9b0d3dc3c0f4c7e7543700ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
import translate from '$i18n/translate';
import tSite from '$i18n/translations/site';
import tComponent from '$i18n/translations/components/scotsoun';
import type Scotsoun from '$types/Scotsoun';
import PayPalButtons from './PayPalButtons.astro';
import relativePath from '$lib/relativePath';
import getLocaleFromPath from '$lib/getLocaleFromPath';

interface Props {
  scotsoun: Scotsoun;
}

const { scotsoun } = Astro.props;
const locale = getLocaleFromPath(Astro.url.pathname);
const t = translate(locale);
---

<section class="section--full-width">
  <div class="product__header-block">
    <header>
      <h1>{scotsoun.title}</h1>
      {scotsoun?.subtitle && <p class="italic">{scotsoun.subtitle}</p>}
      {
        scotsoun?.author && (
          <p>
            {t(tSite, { key: 'by' })} {scotsoun.author}
          </p>
        )
      }
    </header>
    <div class="product__action-block">
      <img src={`/images/scotsoun/sscd${scotsoun.scotsounId}.jpg`} />
      <PayPalButtons
        successPageUrl={relativePath(Astro.url.pathname, `payment-success-confirmation`)}
        productDescription={scotsoun.longName}
        shortDescription={scotsoun.title}
        totalPrice={scotsoun.price}
      />
    </div>
  </div>

  <section>
    {scotsoun?.description && <p>{scotsoun.description[locale]}</p>}

    {
      scotsoun?.coverArtist && (
        <p>{t(tComponent, { key: 'cover-artist', coverArtist: scotsoun.coverArtist })}</p>
      )
    }

    {
      scotsoun?.releaseDate && (
        <p>{t(tComponent, { key: 'release-date', releaseDate: scotsoun.releaseDate })}</p>
      )
    }

    {
      scotsoun?.trackList && scotsoun.trackList.length > 1 && (
        <>
          <h2>Track list</h2>
          <ol>
            {scotsoun.trackList.map((track) => (
              <li>{track}</li>
            ))}
          </ol>
        </>
      )
    }
  </section>
</section>