3d-carousel-component 中文文档教程

发布于 3年前 浏览 28 项目主页 更新于 3年前

3d-carousel-component

  • 用于 react.js 的经典 3d 旋转木马;✨????

    Example

    看看 示例

Table of Contents

Getting Started????

npm i 3d-carousel-component

import Carousel3D from "3d-carousel-component";

const YourComponent = () => {
  return (
    <Carousel3D
      ContainerStyle={ContainerStyle}
      CardStyle={CardStyle}
      CardList={CardList}
    />
  );
};

Customization????

  • 基本上你必须传递三个道具,即:

  • ContainerStyle

  • CardStyle

  • CardList

  • 其中前两个用于样式,最后一个包含你的卡列表。

  • 请注意所有变量、道具、属性都遵循 UpperCamelCase 规则。*

    ContainerStyle

  • 它允许您设置轮播的主要外部容器的样式。

  • 以下属性可用:

    KeyFunction
    WidthWidth of the main container
    HeightHeight of the main container
    PaddingPadding of the main container
    MarginMargin of the main container
    BackgroundColorBackground color of the main container
    BackgroundBackground property
  • 查看下面的示例以获得更多理解。

    CardStyle

  • 它允许您为轮播的每张卡片设置样式。

  • 以下属性可用:

    KeyFunction
    WidthWidth of each Card
    HeightHeight of each Card
    PaddingPadding inside of your Card
    AspectRatioDefines Aspect ratio of your Card
  • 查看下面的示例以获得更多理解。

    CardList

  • 它基本上是一组带有 “元素” 键的对象,其中包含您的卡片内容。 可以是您想要的任何内容……嵌入 youtube 视频的轮播怎么样????

Examples????

import Carousel3D from  "3d-carousel-component";

const YourComponent  =  ()  =>  {
    //List of element you want inside carousel.
    const  CardList  = [
        { element:  <div>Card 1</div>, },
        { element:  <div>Card 2</div>, },
        { element:  <div>Card 3</div>, },
        { element:  <div>Card 4</div>, },
        { element:  <div>Card 5</div>, },
        { element:  <div>Card 6</div>, },
        { element:  <div>Card 7</div>, },
        { element:  <div>Card 8</div>, },
    ];
    const ContainerStyle = {
        BackgroundColor:  "Cyan",
        Width:  "100%",
        Padding:  "1em",
        Margin:  "auto",
    };
    const CardStyle = {
        Width:  "100%",
        BackgroundColor: "blanchedalmond",
        Padding:  "0.5em 1em",
    };

    return  <Carousel3D
            ContainerStyle={ContainerStyle}
            CardStyle={CardStyle}
            CardList={CardList}
        />;
};

export defalut YourComponent;

示例代码链接:点击此处

Issues??????

  • Having any issues or found any bugs, feel free to reach me on github - click here.????

Special Mention????

  • Special Thanks to Akshit Gupta for constant motivation and support.

3d-carousel-component

  • A classy 3d carousel for react.js;✨????

    Example

    Have a Look at the Example

Table of Contents

Getting Started????

npm i 3d-carousel-component

import Carousel3D from "3d-carousel-component";

const YourComponent = () => {
  return (
    <Carousel3D
      ContainerStyle={ContainerStyle}
      CardStyle={CardStyle}
      CardList={CardList}
    />
  );
};

Customization????

  • Basically you have to pass three props, Namely:

  • ContainerStyle

  • CardStyle

  • CardList

  • Out of this first two are for styling and last one contains list of your cards.

  • Note all variables, props, properties follow UpperCamelCase Rule.*

    ContainerStyle

  • It allows you to style the main outer container of carousel.

  • Following properties are available:

    KeyFunction
    WidthWidth of the main container
    HeightHeight of the main container
    PaddingPadding of the main container
    MarginMargin of the main container
    BackgroundColorBackground color of the main container
    BackgroundBackground property
  • Look at the example below for more understanding.

    CardStyle

  • It allows you to style each card of the carousel.

  • Following properties are available:

    KeyFunction
    WidthWidth of each Card
    HeightHeight of each Card
    PaddingPadding inside of your Card
    AspectRatioDefines Aspect ratio of your Card
  • Look at the example below for more understanding.

    CardList

  • It bassically an array of objects with "element" key containing content of your card. Can be anyting you wish to have…How about a carousel with embeded youtube videos.????

Examples????

import Carousel3D from  "3d-carousel-component";

const YourComponent  =  ()  =>  {
    //List of element you want inside carousel.
    const  CardList  = [
        { element:  <div>Card 1</div>, },
        { element:  <div>Card 2</div>, },
        { element:  <div>Card 3</div>, },
        { element:  <div>Card 4</div>, },
        { element:  <div>Card 5</div>, },
        { element:  <div>Card 6</div>, },
        { element:  <div>Card 7</div>, },
        { element:  <div>Card 8</div>, },
    ];
    const ContainerStyle = {
        BackgroundColor:  "Cyan",
        Width:  "100%",
        Padding:  "1em",
        Margin:  "auto",
    };
    const CardStyle = {
        Width:  "100%",
        BackgroundColor: "blanchedalmond",
        Padding:  "0.5em 1em",
    };

    return  <Carousel3D
            ContainerStyle={ContainerStyle}
            CardStyle={CardStyle}
            CardList={CardList}
        />;
};

export defalut YourComponent;

Example Code Link: click here

Issues??????

  • Having any issues or found any bugs, feel free to reach me on github - click here.????

Special Mention????

  • Special Thanks to Akshit Gupta for constant motivation and support.
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文