mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-24 02:36:00 +00:00
32 lines
654 B
TypeScript
32 lines
654 B
TypeScript
import React from "react";
|
|
|
|
interface Props {
|
|
children: string | number;
|
|
className?: string;
|
|
}
|
|
|
|
export const characterClassName = (char: string | number) =>
|
|
`character-${char
|
|
.toString()
|
|
.toLowerCase()
|
|
.charCodeAt(0)}`;
|
|
|
|
const Character = ({
|
|
children: char,
|
|
className,
|
|
...passThrough
|
|
}: Props &
|
|
// TODO: Seems like there should be a better way to do pass through props
|
|
React.DetailedHTMLProps<
|
|
React.HTMLAttributes<HTMLSpanElement>,
|
|
HTMLSpanElement
|
|
>) => (
|
|
<span
|
|
{...passThrough}
|
|
className={`${className || ""} character ${characterClassName(char)}`}
|
|
>
|
|
{char}
|
|
</span>
|
|
);
|
|
|
|
export default Character;
|