import React from 'react'
import { ContentProps } from '../../types'
import * as ComponentWorkarounds from '../Workarounds'

interface TweetProps extends ContentProps<ComponentWorkarounds.Tweet> {}

const Tweet: React.FC<TweetProps> = ({ content: tweet }) => {
  if (tweet.html) {
    return (
      <div
        className="n-content-tweet"
        dangerouslySetInnerHTML={{ __html: tweet.html }}
      />
    )
  } else if (tweet.id) {
    return (
      <p>
        <a href={tweet.id}>{tweet.id}</a>
      </p>
    )
  }
  return null
}

export default Tweet
