•  


GitHub - mannynotfound/react-tweet: React.js component for rendering tweets as they are presented on Twitter.com
Skip to content

React.js component for rendering tweets as they are presented on Twitter.com

Notifications You must be signed in to change notification settings

mannynotfound/react-tweet

Repository files navigation

live demo

React.js component for rendering tweets as they are presented on Twitter.com. Currently themed after the Desktop experience with the idea of a fixed width timeline. See the example app for an example of a tweet stream.

Motivation

react-tweet should make it easier to boostrap Twitter based React.js apps. This way we can focus on interesting ways to use and manipulate the API without the pains of rendering. Styles, assets, and HTML have been lifted from twitter.com and twitter dev docs . react-tweet uses only inline styles and while written in ES6, compiles to plain JS meant to be absorbed by any React project. react-tweet can be used a 'dumb' component for simply rendering data or could be a starting point for a more ambitious Tweet component.

Dependencies

To get full video functionality, include videojs in your app. You can use the http://vjs.zencdn.net/5-unsafe/video.js as a CDN path. If you dont include videojs it should fall back to native HTML5 video.

Usage

Pass in tweet objects returned from twitter API Requests as a 'data' prop. Designed for use with search & home_timeline methods, although any object can be used as long as it has the following properties:

import
 React
 from
 'react'

import
 Tweet
 from
 'react-tweet'


const
 tweetData
 =
 {

  id_str
: 
'XXX'
,

  user
: 
{

    name
: 
'XXX'
,

    screen_name
: 
'XXX'
,

    profile_image_url
: 
'XXX'

  }
,

  text
: 
'XXX'
,

  created_at
: 
'XXX'
,

  favorite_count
: 
'XXX'
,

  retweet_count
: 
'XXX'
,

  entities
: 
{

    media
: 
[
]
,

    urls
: 
[
]
,

    user_mentions
: 
[
]
,

    hashtags
: 
[
]
,

    symbols
: 
[
]

  }
 
}


class
 MyTweetComponent
 extends
 React
.
Component
 {

  render
 (
)
 {

    // use linkProps if you want to pass attributes to all links

    const
 linkProps
 =
 {
target
: 
'_blank'
,
 rel
: 
'noreferrer'
}


    return
 (

      <
Tweet
 data
=
{
tweetData
}
 linkProps
=
{
linkProps
}
 /
>

    )

  }

}

Demo

  • live: live demo
  • local: run npm start & visit localhost:8080

Supported

  • Desktop Twitter.com styles
  • Retweets
  • Quote tweets
  • Auto-linking via twitter-text
  • Twitter Emoji support via twemoji
  • Modal mode for images
  • Isomorphic Rendering

TODO:

  • Mobile style support
  • Better video support, seems Twitter uses custom player
  • Mimick video controls of Twitter.com
  • Add slideshow controls in Modal mode
  • Refactor how images get cropped, kind of a mess rn
  • Support for Tweet threads
  • Tests

About

React.js component for rendering tweets as they are presented on Twitter.com

Resources

Stars

Watchers

Forks

Packages

No packages published
- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본