Update AGENTS.md. Start fixing old weird errors
This commit is contained in:
@@ -12,12 +12,12 @@ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
||||
type CarouselOptions = UseCarouselParameters[0];
|
||||
type CarouselPlugin = UseCarouselParameters[1];
|
||||
|
||||
type CarouselProps = {
|
||||
interface CarouselProps {
|
||||
opts?: CarouselOptions;
|
||||
plugins?: CarouselPlugin;
|
||||
orientation?: 'horizontal' | 'vertical';
|
||||
setApi?: (api: CarouselApi) => void;
|
||||
};
|
||||
}
|
||||
|
||||
type CarouselContextProps = {
|
||||
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
||||
@@ -30,7 +30,7 @@ type CarouselContextProps = {
|
||||
|
||||
const CarouselContext = React.createContext<CarouselContextProps | null>(null);
|
||||
|
||||
function useCarousel() {
|
||||
const useCarousel = () => {
|
||||
const context = React.useContext(CarouselContext);
|
||||
|
||||
if (!context) {
|
||||
@@ -38,9 +38,9 @@ function useCarousel() {
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
};
|
||||
|
||||
function Carousel({
|
||||
const Carousel = ({
|
||||
orientation = 'horizontal',
|
||||
opts,
|
||||
setApi,
|
||||
@@ -48,7 +48,7 @@ function Carousel({
|
||||
className,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<'div'> & CarouselProps) {
|
||||
}: React.ComponentProps<'div'> & CarouselProps) => {
|
||||
const [carouselRef, api] = useEmblaCarousel(
|
||||
{
|
||||
...opts,
|
||||
@@ -128,9 +128,12 @@ function Carousel({
|
||||
</div>
|
||||
</CarouselContext.Provider>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
const CarouselContent = ({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<'div'>) => {
|
||||
const { carouselRef, orientation } = useCarousel();
|
||||
|
||||
return (
|
||||
@@ -149,9 +152,9 @@ function CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function CarouselItem({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
const CarouselItem = ({ className, ...props }: React.ComponentProps<'div'>) => {
|
||||
const { orientation } = useCarousel();
|
||||
|
||||
return (
|
||||
@@ -167,14 +170,14 @@ function CarouselItem({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function CarouselPrevious({
|
||||
const CarouselPrevious = ({
|
||||
className,
|
||||
variant = 'outline',
|
||||
size = 'icon-sm',
|
||||
...props
|
||||
}: React.ComponentProps<typeof Button>) {
|
||||
}: React.ComponentProps<typeof Button>) => {
|
||||
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
||||
|
||||
return (
|
||||
@@ -197,14 +200,14 @@ function CarouselPrevious({
|
||||
<span className='sr-only'>Previous slide</span>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function CarouselNext({
|
||||
const CarouselNext = ({
|
||||
className,
|
||||
variant = 'outline',
|
||||
size = 'icon-sm',
|
||||
...props
|
||||
}: React.ComponentProps<typeof Button>) {
|
||||
}: React.ComponentProps<typeof Button>) => {
|
||||
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
||||
|
||||
return (
|
||||
@@ -227,7 +230,7 @@ function CarouselNext({
|
||||
<span className='sr-only'>Next slide</span>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
type CarouselApi,
|
||||
|
||||
Reference in New Issue
Block a user