Giter Club home page Giter Club logo

bear-react-carousel's People

Contributors

imagine10255 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bear-react-carousel's Issues

feature: Increase Test coverage than 70%

Is your feature request related to a problem? Please describe.
Increasing test coverage can mitigate the risk of issues arising during modifications.

Describe the solution you'd like
Increase test coverage to over 70%.
Reduce the issue of one requirement change adversely affecting another requirement.

bug: scroll on touch screen devices does not work

Describe the bug
On mobile, its not possible to scroll when you try to scroll in a carousel element

To Reproduce
Go to a any mobile phone
Scroll vertically on a carousel element

Expected behavior
The scroll should be possible

Smartphone (please complete the following information):

  • Device: Samsung Galaxy S23
  • OS: Android 14
  • Browser Chrome
  • Version Latest

Additional context

Maybe you would want to listen to this event
https://developer.mozilla.org/en-US/docs/Web/API/Element/pointercancel_event

if (e.type === 'pointercancel') return;

add juejin member level sync effect example

Is your feature request related to a problem? Please describe.
Provide usage instructions in sample files

Describe the solution you'd like
Synchronize controls and make controls not just move horizontally

717904924.221424.mp4

Add delay for "autoPlayTime"

When using the autoPlayTime attribute, it would be nice to have delayAutoPlayTime.

This feature allows a user to set each carousel to start at different times.

PS. Love this carousel Lib, you've done an amazing job 👌

bug: activePage is greater than total when using more than 1 slidesPerView with isEnableLoop={true} and going to the borders

Describe the bug
ActivePage is greater than the total number of pages and the page indicator shows as empty
image

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://bear-react-carousel.pages.dev/docs/props-try
  2. Click the left arrow or swipe (because if you don't go to the left, the right arrow will never show, i guess that's another bug)
  3. Disable auto mode
  4. Set slides per view to 2
  5. Click the right arrow 2 times (or swipe to the left 2 times)
  6. See error
    image
    image

Expected behavior
Everything should work and the indicator should indicate the current page and not empty

(Btw, awesome library! keep up the good work)

Props: isEnableMouseMove

The prop isEnableMouseMove is not working in chrome.
I'm trying add isEnableMouseMove: true or isEnableMouseMove={true}, and I tried to use this prop in breakpoints, but hapens the same thing, doesn't work either.

data diff not update

He has a data props to pass in the style of each carousel card, does this data have memo live, when the data changes, the picture does not change

feature: Reduce the package size by 30%.

Is your feature request related to a problem? Please describe.
Currently, the project's Unpacked Size is 113KB. Any additional code to meet new requirements could potentially increase the packed size.

Describe the solution you'd like
aim is to reduce this size by rewriting it with Hooks.

feature: Loop mode use sort by one slide pre view

Is your feature request related to a problem? Please describe.
the text animation is interrupted when it is reset

Describe the solution you'd like
In Loop mode, if slidePreView is 1, use the method of changing the order to Loop
Use Clone as otherwise

RWD Preview not work

why gridBreakpoints.xl not work staticHeight?

const HomeBanner = () => {

    const navigate = useNavigate();

    const isAuth = useSelector(authSelector.isAuth);
    const HomeBanner = commonHook.useGetHomeBanner();

    const handleClickButton = useCallback((href: string, isBlank: boolean) => {
        if(isBlank){
            window.open(href);
        }else{
            // 不需要開新視窗就當作是站內
            navigate(href);
        }
    }, [isAuth]);


    // 輪播項目
    const bearSlideItemData: TBearSlideItemDataList|undefined = HomeBanner.data?.map(row => {
        return {
            key: row.id,
            paginationContent: <>{row.title}</>,
            children: <BearSlideItem imageUrl={uploadUrl(row.imageUrl)}
                onClick={() => {
                    const btn = row.button1;
                    if(isNotEmpty(btn.href)){
                        handleClickButton(btn.href, getMainDomain(btn.href) !== '');
                    }
                }}
            />
        };
    });

    return <CarouselBox>
        <BearCarousel
            data={bearSlideItemData}
            slidesPerView={1}
            slidesPerGroup={1}
            isEnablePagination
            isEnableNavButton
            isEnableLoop
            autoPlayTime={autoPlayTime}
            isEnableAutoPlay
            aspectRatio={{
                widthRatio: 21, heightRatio: 9,
            }}
            renderNavButton={(toPrev, toNext) => {
                return (
                    <div className={elClassName.navGroup}>
                        <button type="button" className={elClassName.navPrevButton} onClick={() => toPrev()}>
                            <Icon code={EIconCode.chevrons_right} color="#fff" size={50}/>
                        </button>
                        <button type="button" className={elClassName.navNextButton} onClick={() => toNext()}>
                            <Icon code={EIconCode.chevrons_right} color="#fff" size={50}/>
                        </button>
                    </div>
                );
            }}
            breakpoints={{
                [gridConfig.gridBreakpoints.xl]: {
                    staticHeight: 'calc(100vh - 30px)',
                },
            }}
        />
    </CarouselBox>;
};

export default HomeBanner;




const CarouselBox = styled.div`

    height: auto;
    z-index: 0;

    .${elClassName.paginationGroup}{
      bottom: 40px;
    }
    .${elClassName.paginationButton}{

      width: 15px;
      height: 15px;
      margin: 0 7.5px;
      border-radius: 50%;
      border: 2px solid #fff;
      background-color: transparent;
      opacity: 1;
      
      animation: width .4s linear infinite;
      &[data-active=true] {
        background-color: #fff;
      }
    }

    .${elClassName.paginationContent}{
        display: none;
    }

  .${elClassName.navPrevButton},  .${elClassName.navNextButton}{
    background-color: transparent;
    opacity: 1;
    width: 50px;
  }
    .${elClassName.navPrevButton}{
      transform: rotate(180deg);
     
    }
    .${elClassName.navNextButton}{
      transform: rotate(0deg);

    }
  
  
`;

BearSlideCard child use padding

Describe the bug
BearSlideCard child use padding

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macos
  • Safari
  • 14.2.1(23C71)

Additional context
CleanShot 2024-01-26 at 14 57 22@2x

import {formatCurrency} from 'bear-jsutils/number';
import {Flex,media} from 'bear-react-grid';
import CSS from 'csstype';
import styled from 'styled-components';

import {asset} from '@/utils/config';


export interface IRules {
    title: string
    value: any
}


interface IProps {
    style?: CSS.Properties
    className?: string
    isActive?: boolean
    level: number
    levelName: string
    totalAmount: number
    month: number
}

/**
 * VipLevelCard
 */
const VipCard = ({
    isActive = false,
    level,
    levelName,
    totalAmount,
    month,
}: IProps) => {

    return (
        <VipCardRoot data-active={isActive}>
            <StarGroup>
                {Array.from({length: level}).map((row, index) => {
                    return <StarImage src={asset('/images/vip/star.svg')} key={`star_${index}`}/>;
                })}
            </StarGroup>

            <Flex col="column" className="gap-1">
                <Flex className="gap-2 align-items-center">
                    <LevelIconImage src={asset('/images/vip/vip_icon.svg')}/>
                    <LevelName>{levelName}</LevelName>
                </Flex>

                <Flex className="gap-2 align-items-center">
                    <LevelIconImage src={asset('/images/vip/lightning.svg')} style={{height: '40px'}}/>
                    <LevelName>
                        <TotalAmount>
                            {formatCurrency(totalAmount)}
                        </TotalAmount>
                        <TotalAmountTitle>
                            需求
                        </TotalAmountTitle>
                    </LevelName>
                </Flex>

                <Flex className="gap-2 align-items-center">
                    <LevelIconImage src={asset('/images/vip/heart.svg')}/>
                    <LevelDesc>{month}</LevelDesc>
                </Flex>
            </Flex>




        </VipCardRoot>
    );
};

export default VipCard;



const TotalAmountTitle = styled.div`
    color: #fff;
    font-family: "Noto Sans TC";
    font-size: 12px;
    font-weight: 700;
`;

const TotalAmount = styled.div`
    color: #FFF;
    font-family: Righteous;
    font-size: 24px;
    font-weight: 400;
`;


const LevelDesc = styled.div`
    color: #fff;
    font-family: "Noto Sans TC";
    font-size: 14px;
    font-weight: 700;
`;


const LevelIconImage = styled.img`
  width: 35px;
`;


const LevelName = styled.div`
    color: #FFF;
    font-family: Righteous;
    font-size: 19.64px;
    font-weight: 400;
`;


const StarImage = styled.img`

`;

const StarGroup = styled(Flex)`
    justify-content: flex-end;
`;



const VipCardRoot = styled.div<{
    'data-active': boolean,
}>`
    width: 100%;
    height: 171px;
    padding: 12px 22px;

    border-radius: 13.597px;
    box-shadow: 0px 10.198px 20.395px 0px rgba(224, 164, 77, 0.30), 0px -4px 0px 0px rgba(0, 0, 0, 0.15) inset;
    //border: 1px solid #A4A4A4;
    //background: linear-gradient(285deg, #CFCACA 0.06%, #A1A1A1 90.84%);
    border: 1px solid #E1B400;
    background: linear-gradient(90deg, rgba(240, 155, 76, 0.90) 0%, rgba(245, 211, 91, 0.90) 100%);
    transition: background .3s;
    position: relative;

    :before{
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background: transparent no-repeat center right;
        background-position-x: 30px;
        background-size: 100%;
      background-image: url("${asset('/images/vip/card_bg.svg')}");
        z-index: 1;
    }

    &[data-active="false"]{
        border-radius: 13.597px;
        border: 1px solid #A4A4A4;
        background: linear-gradient(285deg, #CFCACA 0.06%, #A1A1A1 90.84%);
        box-shadow: none;
    }
`;

Deployment error on Vercel

"dependencies": {
    "@headlessui/react": "^1.7.15",
    "@heroicons/react": "^2.0.18",
    "@types/node": "20.3.1",
    "@types/react": "18.2.13",
    "@types/react-dom": "18.2.6",
    "autoprefixer": "10.4.14",
    "bear-react-carousel": "^4.0.9-aplha.0",
    "eslint": "8.43.0",
    "eslint-config-next": "13.4.7",
    "next": "13.4.7",
    "next-auth": "^4.22.1",
    "next-themes": "^0.2.1",
    "postcss": "8.4.24",
    "preline": "^1.9.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-icons": "^4.10.1",
    "react-id-swiper": "^4.0.0",
    "swiper": "^9.4.1",
    "swr": "^2.2.0",
    "tailwindcss": "3.3.2",
    "typescript": "5.1.3"
  }
'use client'

import dynamic from "next/dynamic";
import { BearSlideCard } from "bear-react-carousel";

import "bear-react-carousel/dist/index.css";

const BearCarousel = dynamic(
  () => import("bear-react-carousel").then((mod) => mod), {ssr: false}
);

const Carousel = () => {
  const images = [
    { id: 1, imageUrl: "https://dummyimage.com/900x400/dee2e6/6c757d.jpg" },
    { id: 2, imageUrl: "https://dummyimage.com/900x400/dee2e6/6c757d.jpg" },
    { id: 3, imageUrl: "https://dummyimage.com/900x400/dee2e6/6c757d.jpg" }
  ];

  const bearSlideItemData = images.map((row) => {
    return {
      key: row.id,
      children: <BearSlideCard bgUrl={row.imageUrl} />
    };
  });

  return <BearCarousel data={bearSlideItemData} height="400px" />;
}

export default Carousel;
Failed to compile.
--
09:50:26.402 |  
09:50:26.403 | ./components/Carousel.tsx
09:50:26.403 | Module not found: Package path . is not exported from package /vercel/path0/node_modules/bear-react-carousel (see exports field in /vercel/path0/node_modules/bear-react-carousel/package.json)
09:50:26.403 |  
09:50:26.403 | https://nextjs.org/docs/messages/module-not-found
09:50:26.403 |  
09:50:26.404 |  
09:50:26.404 | > Build failed because of webpack errors
09:50:26.449 | error Command failed with exit code 1.
09:50:26.449 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
09:50:26.473 | Error: Command "yarn run build" exited with 1
09:50:26.937 | BUILD_UTILS_SPAWN_1: Command "yarn run build" exited with 1

Documentation site down

Having looked through the files to check out this carousel I can say I will certainly be using this :)

Just thought I would flag the sites being down.

Also it'd be great to have some form of lightbox incorporated into it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.