From 5e9e51306374e60a2bb08a073b61436ab95f1e28 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Sat, 1 Dec 2018 18:50:18 +0100 Subject: [PATCH] refactor: remove superseded github mentions (#84) --- src/atoms/github-mentions/github-mentions.js | 40 -------------------- src/atoms/github-mentions/index.js | 1 - 2 files changed, 41 deletions(-) delete mode 100644 src/atoms/github-mentions/github-mentions.js delete mode 100644 src/atoms/github-mentions/index.js diff --git a/src/atoms/github-mentions/github-mentions.js b/src/atoms/github-mentions/github-mentions.js deleted file mode 100644 index f866c1a..0000000 --- a/src/atoms/github-mentions/github-mentions.js +++ /dev/null @@ -1,40 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -const MENTIONS_PATTERN = /@([a-z0-9]+)/gi; - -export default function GithubMentionsAtom(props) { - console.log('PROPS', props); - const splitText = props.children.split(MENTIONS_PATTERN); - const matches = props.children.match(MENTIONS_PATTERN); - - if (!splitText) return props.children; - - return ( -

- {splitText.reduce((arr, element) => { - if (!element) return arr; - - if (matches.includes(`@${element}`)) { - return [ - ...arr, - ( - @{element} - ), - ]; - } - - return [...arr, element]; - }, [])} -

- ); -} - -GithubMentionsAtom.propTypes = { - /** The content that has mentions that needs transformed to GitHub links */ - children: PropTypes.string.isRequired, -}; - -GithubMentionsAtom.defaultProps = { - children: '', -}; diff --git a/src/atoms/github-mentions/index.js b/src/atoms/github-mentions/index.js deleted file mode 100644 index eeaa18d..0000000 --- a/src/atoms/github-mentions/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './github-mentions';