diff --git a/js/Character.jsx b/js/Character.jsx index fa33c346..965d10e1 100644 --- a/js/Character.jsx +++ b/js/Character.jsx @@ -6,3 +6,4 @@ module.exports = (props) => { return
{props.children}
; }; +// TODO: Require that props.children be a string diff --git a/js/CharacterString.jsx b/js/CharacterString.jsx new file mode 100644 index 00000000..faa57133 --- /dev/null +++ b/js/CharacterString.jsx @@ -0,0 +1,14 @@ +import React from 'react'; +import Character from './Character.jsx'; + +module.exports = (props) => { + const text = '' + props.children; + const chars = text.split(''); + return
+ {chars.map(character => { + return {character}; + })}; +
; +}; + +// TODO: Require that props.children be a string diff --git a/js/Marquee.jsx b/js/Marquee.jsx index 080dca72..2f06277c 100644 --- a/js/Marquee.jsx +++ b/js/Marquee.jsx @@ -2,7 +2,7 @@ import React from 'react'; import {connect} from 'react-redux'; -import Character from './Character.jsx'; +import CharacterString from './CharacterString.jsx'; class Marquee extends React.Component { @@ -45,11 +45,10 @@ class Marquee extends React.Component { // TODO: Use the spread operator chars = start.concat(end).slice(0, 30); } - return
- {chars.map(character => { - return {character}; - })}; -
; + const text = chars.join(''); + return + {text} + ; } }