# mt-ad-space

> react ad space, is a react component that ad space, build for mobile web app

Latest version **1.0.3** (published 2020-04-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install mt-ad-space
pnpm add mt-ad-space
yarn add mt-ad-space
bun add mt-ad-space
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-04-27 |
| First published | 2020-04-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | https://github.com/shenxuxiang/mt-ad-space |
| Maintainers | shenxuxiang |
| Keywords | ad space, mt-ad-space, carousel, swipper, slide, react, mobile |

## Links

- npm: https://www.npmjs.com/package/mt-ad-space
- Issues: https://github.com/shenxuxiang/mt-ad-space/issues
- npm.io page: https://npm.io/package/mt-ad-space

## Alternatives

- [adhdev](https://npm.io/package/adhdev.md) — 11.1K weekly downloads
- [react-slide-button](https://npm.io/package/react-slide-button.md) — 310 weekly downloads
- [better](https://npm.io/package/better.md) — 42 weekly downloads
- [react-native-swipe-image](https://npm.io/package/react-native-swipe-image.md) — 22 weekly downloads
- [nl.fokkezb.pulltorefresh](https://npm.io/package/nl.fokkezb.pulltorefresh.md) — 11 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2020-04-27
- 1.0.2 — 2020-04-19
- 1.0.1 — 2020-04-19
- 1.0.0 — 2020-04-19

## README

# mt-ad-space

A light-weight React mt-ad-space component with extremely easy API（只适用于移动端项目）. [Online Demo](https://shenxuxiang.github.io/mt-ad-space/), welcome [code review](https://github.com/shenxuxiang/mt-ad-space)

## Installation
```sh
npm install mt-ad-space --save
```

## Usage
```js
import React, { PureComponent } from 'react';
import img1 from './static/images/11.jpg';
import img2 from './static/images/12.jpg';
import img3 from './static/images/13.jpg';
import img4 from './static/images/14.jpg';
import img5 from './static/images/15.jpg';
import img6 from './static/images/16.png';
import AdSpace from 'mt-ad-space';
import './app.css';

const source = [img1, img2, img3, ];
const source_2 = [[img1, img2], [img3, img4], [img5, img6]];

export default class App extends PureComponent {
  constructor() {
    super();
    this.state = {
      indicator: 0,
    };
  }

  render() {
    return (
      <div className="container">
        <div style={{ height: 200 }}></div>
        <AdSpace 
          width={320}
          spacing={10}
          onChange={(indicator) => {
            this.setState({ indicator })
          }}
        >
          {
            source.map((item, key) =>
              <div key={key} className="item">
                <img src={item} />
              </div>
            )
          }
        </AdSpace>
        <h1>{this.state.indicator}</h1>
        <AdSpace 
          width={320}
          spacing={10}
        >
          {
            source_2.map((item, key) =>
              <ul key={key} className="ad-space">
                {
                  item.map(it =>
                    <li className="ad-space-item" key={it}>
                      <img src={it} />
                    </li>
                  )
                }
              </ul>
            )
          }
        </AdSpace>
      </div>
    );
  }
}
```

## props

| param            | detail                                         | type     | default         |
| ---------------- | -----------------------------------------------| -------- | -------         |
| width            | component width                                | number   | isRequired      |
| spacing          | spacing between each element                   | number   | isRequired      |
| children         | child node of component                        | array    | []              |
| onChange         | callback function when channel changes         | function | empty           |

---
_Source: https://npm.io/package/mt-ad-space · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
