@5rabbits/headerstrip 中文文档教程

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

@5rabbits/headerstrip npmTravisCodecov

在您的应用程序中将广告活动显示为标题横幅的组件。 将行为本地存储在 localStorage 上。

Usage

  • Install with yarn add @5rabbits/headerstrip.
  • Install peer dependencies (if you haven't already) yarn add react@^16.0.0 react-dom@^16.0.0.
  • Use the component:
import Headerstrip from '@5rabbits/headerstrip'
import '@5rabbits/headerstrip/dist/headerstrip.css'

<Headerstrip />

演示

Props

proptypedefaultrequireddescription
idstringtrueAdvertising unique id, if not supplied the headerstrip will not render.
titlestring'Placeholder title'Headerstrip title, the main message should be here.
textsobject{accept: 'Accept', dismiss: 'Dismiss', remind_me_later: 'Snooze'}Texts used in the component action buttons.
onAcceptfunctionCallback when accept button is clicked.
onDismissfunctionCallback when dismiss button is clicked.
onSnoozefunctionCallback when snooze button is clicked.

Development

  • Run yarn start to start building the library in watch mode.
  • Write stories in the stories/index.js file.
  • This project lints and prettifies source files automatically before commiting. You can run yarn lint and yarn prettify to do this operations manually before commiting (although you shouldn't need to).

Testing

  • Pending

@5rabbits/headerstrip npmTravisCodecov

A component to display advertising campaings as a header banner in your apps. Stores behavior locally on localStorage.

Usage

  • Install with yarn add @5rabbits/headerstrip.
  • Install peer dependencies (if you haven't already) yarn add react@^16.0.0 react-dom@^16.0.0.
  • Use the component:
import Headerstrip from '@5rabbits/headerstrip'
import '@5rabbits/headerstrip/dist/headerstrip.css'

<Headerstrip />

Demo

Props

proptypedefaultrequireddescription
idstringtrueAdvertising unique id, if not supplied the headerstrip will not render.
titlestring'Placeholder title'Headerstrip title, the main message should be here.
textsobject{accept: 'Accept', dismiss: 'Dismiss', remind_me_later: 'Snooze'}Texts used in the component action buttons.
onAcceptfunctionCallback when accept button is clicked.
onDismissfunctionCallback when dismiss button is clicked.
onSnoozefunctionCallback when snooze button is clicked.

Development

  • Run yarn start to start building the library in watch mode.
  • Write stories in the stories/index.js file.
  • This project lints and prettifies source files automatically before commiting. You can run yarn lint and yarn prettify to do this operations manually before commiting (although you shouldn't need to).

Testing

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