From 28da512bacbb1c2211a03318c393dab0f5bcb4d7 Mon Sep 17 00:00:00 2001 From: Korbs Date: Sat, 22 Jun 2024 16:50:07 -0400 Subject: [PATCH] Add Video Item component --- src/components/common/VideoItem.astro | 76 +++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/components/common/VideoItem.astro diff --git a/src/components/common/VideoItem.astro b/src/components/common/VideoItem.astro new file mode 100644 index 0000000..c1906ee --- /dev/null +++ b/src/components/common/VideoItem.astro @@ -0,0 +1,76 @@ +--- +// Properties +const { + ID, + Title, + Creator, + Views, + UploadDate, + Length +} = Astro.props + +// i18n +import { t } from "i18next" + +// Format Published Date +const DateFormat = new Date(UploadDate * 1000).toLocaleDateString() + +// Format Video Length +// Thanks to "mingjunlu" for helping out with the time format + +// Format Views +const ViewsConversion = Intl.NumberFormat('en', { notation: 'compact'}) +const ViewsFormat = ViewsConversion.format(Views) +--- + + +
+ +
+
+

{Title}

+

{t("watch.By")} {Creator}

+

{ViewsFormat} {t("watch.Views")} - {DateFormat}

+
+
+ + \ No newline at end of file