diff --git a/Website/src/activitys/ModuleViewActivity/tabs/OverviewTab.tsx b/Website/src/activitys/ModuleViewActivity/tabs/OverviewTab.tsx
index a37a7ee7..ef0b9d72 100644
--- a/Website/src/activitys/ModuleViewActivity/tabs/OverviewTab.tsx
+++ b/Website/src/activitys/ModuleViewActivity/tabs/OverviewTab.tsx
@@ -27,6 +27,8 @@ import { useCategories } from "@Hooks/useCategories";
import { useFormatDate } from "@Hooks/useFormatDate";
import { ModuleViewActivity } from "..";
import { useRepos } from "@Hooks/useRepos";
+import { Carousel } from "@Components/onsenui/Carousel";
+import { CarouselItem } from "@Components/onsenui/CarouselItem";
const OverviewTab = () => {
const { strings } = useStrings();
@@ -223,24 +225,31 @@ const OverviewTab = () => {
{track.screenshots.map((image, i) => (
({
+ component={CarouselItem}
+ key={i}
+ sx={{
ml: 1,
mr: 1,
- })}
+ }}
>
-
+
))}
diff --git a/Website/src/components/dapi/Image.tsx b/Website/src/components/dapi/Image.tsx
index 8a115fc6..3ca23347 100644
--- a/Website/src/components/dapi/Image.tsx
+++ b/Website/src/components/dapi/Image.tsx
@@ -1,4 +1,5 @@
import PicturePreviewActivity from "@Activitys/PicturePreviewActivity";
+import { GestureDetector } from "@Components/onsenui/GestureDetector";
import { useActivity } from "@Hooks/useActivity";
import { ModFS, useModFS } from "@Hooks/useModFS";
import { useTheme } from "@Hooks/useTheme";
@@ -36,19 +37,8 @@ function Image(props: Props) {
}, [src]);
return (
- {
+ {
if (!noOpen) {
context.pushPage({
component: PicturePreviewActivity,
@@ -59,8 +49,22 @@ function Image(props: Props) {
});
}
}}
- {...rest}
- />
+ >
+
+
);
}
diff --git a/Website/src/components/onsenui/Carousel.tsx b/Website/src/components/onsenui/Carousel.tsx
new file mode 100644
index 00000000..83416b97
--- /dev/null
+++ b/Website/src/components/onsenui/Carousel.tsx
@@ -0,0 +1,51 @@
+import onsCustomElement from "@Util/onsCustomElement";
+import { SxProps } from "@mui/material";
+import React from "react";
+
+const deprecated = {
+ index: "activeIndex",
+};
+
+const Element = onsCustomElement("ons-carousel", { deprecated })({});
+
+const Carousel = React.forwardRef((props, ref) => {
+ const { itemWidth, itemHeight, ...rest } = props;
+
+ // string values for itemWidth and itemHeight are deprecated but handle them
+ // safely anyway to avoid breaking user code
+ const stringify = (x) => (typeof x === "number" ? `${x}px` : x);
+ const realItemWidth = stringify(itemWidth);
+ const realItemHeight = stringify(itemHeight);
+
+ return (
+
+ {props.children}
+
+ );
+});
+
+interface HTMLCarousel extends React.PropsWithChildren {
+ sx?: SxProps;
+ direction?: "horizontal" | "vertical";
+ fullscreen?: boolean;
+ overscrollable?: boolean;
+ centered?: boolean;
+ itemWidth?: string;
+ itemHeight?: string;
+ autoScroll?: boolean;
+ autoScrollRatio?: number;
+ swipeable?: boolean;
+ disabled?: boolean;
+ activeIndex?: number;
+ index?: number;
+ autoRefresh?: boolean;
+ onPreChange?: Function;
+ onPostChange?: Function;
+ onRefresh?: Function;
+ onOverscroll?: Function;
+ animation?: string;
+ animationOptions?: object;
+ onSwipe?: Function;
+}
+
+export { Carousel };
diff --git a/Website/src/components/onsenui/CarouselItem.tsx b/Website/src/components/onsenui/CarouselItem.tsx
new file mode 100644
index 00000000..9b56533e
--- /dev/null
+++ b/Website/src/components/onsenui/CarouselItem.tsx
@@ -0,0 +1,11 @@
+import onsCustomElement from "@Util/onsCustomElement";
+import { SxProps } from "@mui/material";
+
+const CarouselItem = onsCustomElement("ons-carousel-item")({});
+
+interface HTMLCarouselItem extends React.PropsWithChildren {
+ sx?: SxProps;
+ modifier?: string;
+}
+
+export { HTMLCarouselItem, CarouselItem };
diff --git a/Website/src/typings/global.d.ts b/Website/src/typings/global.d.ts
index fbaba79c..ed233561 100644
--- a/Website/src/typings/global.d.ts
+++ b/Website/src/typings/global.d.ts
@@ -42,6 +42,8 @@ declare global {
"ons-gesture-detector": HTMLAttributes;
"ons-bottom-toolbar": HTMLAttributes;
"ons-fab": HTMLAttributes;
+ "ons-carousel": HTMLAttributes;
+ "ons-carousel-item": HTMLAttributes;
}
}