mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 17:47:16 +00:00
24 lines
502 B
JavaScript
24 lines
502 B
JavaScript
import React from 'react';
|
|
|
|
export const characterClassName = (char) => (
|
|
`character-${char.toString().toLowerCase().charCodeAt(0)}`
|
|
);
|
|
|
|
const Character = ({children: char, id}) => (
|
|
<div
|
|
id={id}
|
|
className={`character ${characterClassName(char)}`}
|
|
>
|
|
{char}
|
|
</div>
|
|
);
|
|
|
|
Character.propTypes = {
|
|
children: React.PropTypes.oneOfType([
|
|
React.PropTypes.string,
|
|
React.PropTypes.number
|
|
]).isRequired
|
|
};
|
|
|
|
export default Character;
|
|
// TODO: Require that props.children be a string
|