Skip to content

Commit 2edeb9b

Browse files
committed
update API again
1 parent 50f7a20 commit 2edeb9b

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

packages/frosted-ui/.storybook/stories/components/lightbox.stories.tsx

+12-8
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ export const Default: Story = {
2828
<Lightbox.Root>
2929
<Flex gap="3">
3030
<Lightbox.Triggers>
31-
<Lightbox.Trigger
32-
src="https://img-v2-prod.whop.com/hBOMqb1G4YIzR0jw7qnF0_IkXBoAOh78ybHZt_mKrT8/rs:fit:1280:720/el:1/dpr:2/aHR0cHM6Ly9hc3NldHMud2hvcC5jb20vdXBsb2Fkcy8yMDI0LTExLTEyL3VzZXJfMjMzNDg3XzAxMmY0ZDBkLWY1M2UtNGJhZS1iOTNhLWI3YTVhODhjMjA1Yy5wbmc"
33-
alt="placeholder"
34-
/>
35-
<Lightbox.Trigger
36-
src="https://img-v2-prod.whop.com/7nS_TeQmzSCCznok6NSF4dsz-UivsmFcSIejHh_diFU/rs:fit:1280:720/el:1/dpr:2/aHR0cHM6Ly9hc3NldHMud2hvcC5jb20vdXBsb2Fkcy8yMDI0LTExLTEyL3VzZXJfMjMzNDg3XzM1YmRkZjAwLTgzNDMtNDE4Yy1hYzYzLWZkY2VmYWU2YzBhYS5wbmc"
37-
alt="placeholder"
38-
/>
31+
<Lightbox.Trigger>
32+
<img
33+
src="https://img-v2-prod.whop.com/hBOMqb1G4YIzR0jw7qnF0_IkXBoAOh78ybHZt_mKrT8/rs:fit:1280:720/el:1/dpr:2/aHR0cHM6Ly9hc3NldHMud2hvcC5jb20vdXBsb2Fkcy8yMDI0LTExLTEyL3VzZXJfMjMzNDg3XzAxMmY0ZDBkLWY1M2UtNGJhZS1iOTNhLWI3YTVhODhjMjA1Yy5wbmc"
34+
alt="placeholder"
35+
/>
36+
</Lightbox.Trigger>
37+
<Lightbox.Trigger>
38+
<img
39+
src="https://img-v2-prod.whop.com/7nS_TeQmzSCCznok6NSF4dsz-UivsmFcSIejHh_diFU/rs:fit:1280:720/el:1/dpr:2/aHR0cHM6Ly9hc3NldHMud2hvcC5jb20vdXBsb2Fkcy8yMDI0LTExLTEyL3VzZXJfMjMzNDg3XzM1YmRkZjAwLTgzNDMtNDE4Yy1hYzYzLWZkY2VmYWU2YzBhYS5wbmc"
40+
alt="placeholder"
41+
/>
42+
</Lightbox.Trigger>
3943
</Lightbox.Triggers>
4044
</Flex>
4145

packages/frosted-ui/src/components/lightbox.tsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { ChevronLeft24, ChevronRight24, XMark24 } from "@frosted-ui/icons";
44
import * as DialogPrimitive from "@radix-ui/react-dialog";
55
import classNames from "classnames";
6-
import React, { type ComponentPropsWithoutRef } from "react";
6+
import React, { Children, type ComponentPropsWithoutRef } from "react";
77
import { getValidChildren } from "../helpers";
88
import { useIsomorphicLayoutEffect } from "../helpers/use-isomorphic-layout-effect";
99
import { Theme } from "../theme";
@@ -121,15 +121,16 @@ const LightboxTriggers: React.FC<LightboxTriggersProps> = ({
121121

122122
type LightboxTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;
123123

124-
interface LightboxTriggerProps extends ComponentPropsWithoutRef<"img"> {}
124+
interface LightboxTriggerProps
125+
extends Omit<DialogPrimitive.DialogTriggerProps, "asChild"> {}
125126

126127
const LightboxTrigger: React.FC<LightboxTriggerProps> = React.forwardRef<
127128
LightboxTriggerElement,
128129
LightboxTriggerProps
129-
>((props, forwardedRef) => {
130+
>(({ children, ...props }, forwardedRef) => {
130131
return (
131-
<DialogPrimitive.Trigger ref={forwardedRef} asChild>
132-
<img {...props} />
132+
<DialogPrimitive.Trigger ref={forwardedRef} asChild {...props}>
133+
{children}
133134
</DialogPrimitive.Trigger>
134135
);
135136
});

0 commit comments

Comments
 (0)