Add abcjs (#537)

This commit is contained in:
mrdrogdrog 2020-09-05 08:17:15 +02:00 committed by GitHub
parent 86e41929ef
commit 119c9512e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 82 additions and 0 deletions

View file

@ -0,0 +1,19 @@
import React, { useEffect, useRef } from 'react'
import { renderAbc } from 'abcjs'
export interface AbcFrameProps {
code: string
}
export const AbcFrame: React.FC<AbcFrameProps> = ({ code }) => {
const container = useRef<HTMLDivElement>(null)
useEffect(() => {
if (container.current) {
renderAbc(container.current, code)
}
}, [code])
return (
<div ref={container}/>
)
}