mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
Release Date client component
This commit is contained in:
parent
1222df841b
commit
8f5331b66a
2 changed files with 12 additions and 1 deletions
10
src/components/albumPage/releaseDate.tsx
Normal file
10
src/components/albumPage/releaseDate.tsx
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
const locale =
|
||||||
|
navigator && navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
releaseDate: Date
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ReleaseDate(props: Props) {
|
||||||
|
return <td>{new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }).format(props.releaseDate)}</td>
|
||||||
|
}
|
||||||
|
|
@ -7,6 +7,7 @@ import BaseLayout from 'layouts/base.astro'
|
||||||
import TrackList from 'components/albumPage/TrackList'
|
import TrackList from 'components/albumPage/TrackList'
|
||||||
import DownloadBtn from 'components/albumPage/DownloadBtn.astro'
|
import DownloadBtn from 'components/albumPage/DownloadBtn.astro'
|
||||||
import AlbumBox from 'components/AlbumBox.astro'
|
import AlbumBox from 'components/AlbumBox.astro'
|
||||||
|
import ReleaseDate from 'components/albumPage/releaseDate'
|
||||||
|
|
||||||
import kofi from 'img/socials/ko-fi-donate-button.png'
|
import kofi from 'img/socials/ko-fi-donate-button.png'
|
||||||
import discord from 'img/socials/discord.png'
|
import discord from 'img/socials/discord.png'
|
||||||
|
|
@ -73,7 +74,7 @@ const locale =
|
||||||
album.releaseDate ? (
|
album.releaseDate ? (
|
||||||
<tr>
|
<tr>
|
||||||
<th class='width-row'>{m.releaseDate()}</th>
|
<th class='width-row'>{m.releaseDate()}</th>
|
||||||
<td>{new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }).format(album.releaseDate)}</td>
|
<ReleaseDate client:only='react' releaseDate={album.releaseDate} />
|
||||||
</tr>
|
</tr>
|
||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue