text: // @flow
  import React from 'react';
  import { Link } from 'react-router-dom';
  import renderTextWithLinks from 'src/helpers/render-text-with-markdown-links';
  import addProtocolToString from 'shared/normalize-url';
  import Icon from 'src/components/icon';
  import {
    MetaContainer,
    Name,
    Description,
    MetaLinksContainer,
    MetaRow,
  } from '../style';
  
  type Props = {
    // TODO: Properly type this
    community: Object,
  };
  
  export const CommunityMeta = (props: Props) => {
    const { community } = props;
    const { description, website } = community;
    const formattedDescription = description && renderTextWithLinks(description);
    const formattedWebsite = website && addProtocolToString(website);
  
    return (
      <MetaContainer>
        <Link to={`/${community.slug}`}>
          <Name>{community.name}</Name>
        </Link>
  
        {formattedDescription && (
          <Description>{formattedDescription}</Description>
        )}
  
        <MetaLinksContainer>
          {formattedWebsite && (
            <MetaRow>
              <a
                target="_blank"
                rel="noopener noreferrer"
                href={formattedWebsite}
              >
                <Icon glyph={'link'} size={20} /> {website}
              </a>
            </MetaRow>
          )}
        </MetaLinksContainer>
      </MetaContainer>
    );
  };
  