Skip to content

Commit

Permalink
updated GalleryItemType
Browse files Browse the repository at this point in the history
  • Loading branch information
isoteriksoftware committed Jun 4, 2024
1 parent 1d01293 commit 4157859
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 34 deletions.
4 changes: 0 additions & 4 deletions src/components/Gallery/Gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import { Group } from "three";
* @param item The gallery item properties.
*/
export const Gallery = React.forwardRef<Group, GalleryProps>(({ children, item, ...rest }, ref) => {
// if (children.length < 3) {
// throw new Error("At least 3 Gallery Items are required");
// }

const [itemsId, setItemsId] = useState<string[]>([]);

const {
Expand Down
32 changes: 2 additions & 30 deletions src/components/Gallery/Gallery.types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { GroupProps } from "@react-three/fiber";
import { ReactElement } from "react";
import { GalleryItem, GalleryItemProps } from "../GalleryItem";
import { SolidColorItem, SolidColorItemProps } from "../SolidColorItem";
import { ImageItem, ImageItemProps } from "../ImageItem";
import { VideoItem, VideoItemProps } from "../VideoItem";
import { TransparentItem, TransparentItemProps } from "../TransparentItem";
import { ObjectItem, ObjectItemProps } from "../ObjectItem";

/**
* A flag to indicate that no provider was found.
Expand Down Expand Up @@ -103,39 +97,17 @@ export type UseGalleryReturnType = Omit<
"itemsId" | "registerItem" | "unregisterItem"
>;

/**
* The valid gallery item types.
* These are the types that can be used as children of the Gallery component.
* Any other type will be ignored.
*/
export const AllowedGalleryItemTypes = [
GalleryItem,
SolidColorItem,
ImageItem,
VideoItem,
TransparentItem,
ObjectItem,
];

/**
* The gallery item type.
*/
export type GalleryItemType =
| ReactElement<GalleryItemProps, typeof GalleryItem>
| ReactElement<SolidColorItemProps, typeof SolidColorItem>
| ReactElement<ImageItemProps, typeof ImageItem>
| ReactElement<VideoItemProps, typeof VideoItem>
| ReactElement<TransparentItemProps, typeof TransparentItem>
| ReactElement<ObjectItemProps, typeof ObjectItem>;
export type GalleryItemType = ReactElement;

/**
* The gallery children type.
* This is the type of the children of the Gallery component.
* At least 3 gallery items are required.
*/
export type GalleryChildren =
| [GalleryItemType, GalleryItemType, GalleryItemType, ...GalleryItemType[]]
| GalleryItemType[];
export type GalleryChildren = GalleryItemType | Iterable<GalleryItemType>;

/**
* The Gallery component properties.
Expand Down

0 comments on commit 4157859

Please sign in to comment.