Items counter position and scrollbar for thumbnails #283
-
Beta Was this translation helpful? Give feedback.
Answered by
igordanchenko
Jun 18, 2024
Replies: 1 comment 1 reply
-
I'm afraid there is no such option in the Counter plugin, but you can easily implement your own plugin for this use case. // Counter.tsx
import {
PluginProps,
PLUGIN_THUMBNAILS,
createModule,
ComponentProps,
useLightboxState,
} from "yet-another-react-lightbox";
function CounterComponent({ children }: ComponentProps) {
const { slides, currentIndex } = useLightboxState();
return (
<>
{children}
<div
style={{
color: "white",
position: "absolute",
right: 16,
top: 16,
}}
>
{currentIndex + 1} / {slides.length}
</div>
</>
);
}
export default function Counter({ addParent }: PluginProps) {
addParent(PLUGIN_THUMBNAILS, createModule("counter", CounterComponent));
}
No, I'm afraid not. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
igordanchenko
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm afraid there is no such option in the Counter plugin, but you can easily implement your own plugin for this use case.