mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-18 09:35:20 +02:00
20 lines
417 B
TypeScript
20 lines
417 B
TypeScript
|
import { useEffect } from 'react';
|
||
|
|
||
|
const useItemCss = (itemCss: string) => {
|
||
|
useEffect(() => {
|
||
|
const element = document.createElement('style');
|
||
|
element.setAttribute('type', 'text/css');
|
||
|
element.appendChild(document.createTextNode(`
|
||
|
.note-list-item {
|
||
|
${itemCss};
|
||
|
}
|
||
|
`));
|
||
|
document.head.appendChild(element);
|
||
|
return () => {
|
||
|
element.remove();
|
||
|
};
|
||
|
}, [itemCss]);
|
||
|
};
|
||
|
|
||
|
export default useItemCss;
|