项目作者: attach-live

项目描述 :
React wrapper for Attach embeds
高级语言: JavaScript
项目地址: git://github.com/attach-live/attach-embeds-react.git
创建时间: 2019-09-06T02:35:29Z
项目社区:https://github.com/attach-live/attach-embeds-react

开源协议:MIT License

下载


Attach Embeds React

React components for Attach Embeds

Installation

npm

  1. $ npm install --save attach-embeds attach-embeds-react

yarn

  1. $ yarn add attach-embeds attach-embeds-react

Usage

  1. import React from 'react'
  2. import { attach, Reactions, Preview } from 'attach-embeds-react'
  3. class App extends React.Component {
  4. componentDidMount() {
  5. if (!attach.isInitialized()) {
  6. attach.setProperties({
  7. 'attach:item': `https://www.attach.live`,
  8. 'attach:reactions:hide-sections': ['comments', 'videos'],
  9. })
  10. attach.initialize()
  11. }
  12. }
  13. render() {
  14. return (
  15. <>
  16. <div>
  17. <Reactions item="https://developers.attach.live" ></Reactions>
  18. </div>
  19. <div>
  20. <Reactions properties={{ hide-sections: 'videos' }} ></Reactions>
  21. </div>
  22. <div>
  23. <Preview ></Preview>
  24. </div>
  25. </>
  26. )
  27. }
  28. }

attach

Embeds API, convenient re-export from attach-embeds

Components

All components accept these common props:

  • className, style
  • properties - object, set properties local to the embed
  • item - same as setting properties={{ 'attach:item': '...' }}

Reactions

Renders the reactions embed.

Preview

Renders the preview embed.