fix mdx <S>

This commit is contained in:
sup39 2022-11-06 17:07:20 +09:00
parent add93b2e3e
commit 9c9d3385c8

View file

@ -7,6 +7,9 @@ export function S<E extends React.ElementType='span'>({
$?: string,
_?: string,
} & React.ComponentProps<E>) {
const cls = [className, ...(modifier.match(/\.(\w+)/g) ?? [])].map(s => s.slice(1)).join(' ');
const cls = [
...(className ? [className] : []),
...(modifier.match(/\.(\w+)/g) ?? []),
].map(s => s.slice(1)).join(' ');
return <TagName className={cls} {...props}>{children}</TagName>;
}