Skip to content

Commit

Permalink
Dev bqx (#37)
Browse files Browse the repository at this point in the history
* feat(carousel): add classname on carousel
  • Loading branch information
BQXBQX authored Apr 23, 2024
1 parent ea11828 commit ce50636
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion packages/ui-react/lib/Carousel/Carousel.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ export const DefaultCarousel: Story = {
{ children: <div style={styles}>4</div> },
{ children: <div style={styles}>5</div> },
],
onChange: test,
onchange: test,
defaultSelected: 2,
selected: 1,
className: 'test',
},
};

Expand Down
14 changes: 8 additions & 6 deletions packages/ui-react/lib/Carousel/Carousel.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { memo, useEffect, useRef, useState } from 'react';
import React, { memo, useEffect, useRef, useState, type HtmlHTMLAttributes } from 'react';
import { type CarouselItemProps, CarouselItem } from '..';
import classNames from 'classnames';
import styles from './Carousel.module.scss';

export interface CarouselProps {
export interface CarouselProps extends HtmlHTMLAttributes<HTMLDivElement> {
/**
* width of the carousel
*/
Expand All @@ -19,7 +19,7 @@ export interface CarouselProps {
/**
* onChange : the onChange of the Carousel
*/
onChange?: (value: number) => void;
onchange?: (value: number) => void;
/**
* defaultselect the defaultselect of the Carousel
*/
Expand All @@ -44,10 +44,11 @@ export const Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(
width = 400,
CarouselItems = undefined,
height,
onChange,
onchange,
defaultSelected,
selected,
isSliding = true,
...rest
},
ref,
) => {
Expand Down Expand Up @@ -121,8 +122,8 @@ export const Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(
};

useEffect(() => {
onChange && onChange(select);
}, [select, onChange]);
onchange && onchange(select);
}, [select, onchange]);

useEffect(() => {
if (difference === 0 && !isChanged) {
Expand Down Expand Up @@ -167,6 +168,7 @@ export const Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(
className={carouselClass}
ref={ref}
style={{ width: `${width}px`, height: `${height}px` }}
{...rest}
>
<div
className={styles['carouselAll']}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ui-aurora/react",
"version": "0.0.8",
"version": "0.0.9",
"description": "A React UI library built for SASTOJ",
"author": "sast",
"license": "MIT",
Expand Down

0 comments on commit ce50636

Please sign in to comment.