fix(striker-ui): add string wrapper function

main
Tsu-ba-me 1 year ago
parent e2c264a40f
commit bbbdb42d59
  1. 14
      striker-ui/lib/sxstring.ts

@ -0,0 +1,14 @@
import { ReactNode, createElement } from 'react';
/**
* "jsx"/"tsx" + "string"; wraps input with wrapper if input is a string.
*/
const sxstring = (
children: ReactNode,
wrapper: CreatableComponent,
): ReactNode =>
typeof children === 'string'
? createElement(wrapper, null, children)
: children;
export default sxstring;
Loading…
Cancel
Save