fun
This commit is contained in:
parent
454750047c
commit
890fac1afc
|
|
@ -1,5 +1,4 @@
|
||||||
import { define } from '../src'
|
import { define } from '../src'
|
||||||
|
|
||||||
import { Layout } from './helpers'
|
import { Layout } from './helpers'
|
||||||
|
|
||||||
const P = define('P', {
|
const P = define('P', {
|
||||||
|
|
@ -46,10 +45,12 @@ const ExampleCard = define('ExampleCard', {
|
||||||
},
|
},
|
||||||
|
|
||||||
render({ props: { title, desc }, parts: { Root, H2, P } }) {
|
render({ props: { title, desc }, parts: { Root, H2, P } }) {
|
||||||
return <Root>
|
return (
|
||||||
|
<Root>
|
||||||
<H2>{title}</H2>
|
<H2>{title}</H2>
|
||||||
<P>{desc}</P>
|
<P>{desc}</P>
|
||||||
</Root>
|
</Root>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,7 @@ export function define(nameOrDef: string | TagDef, defIfNamed?: TagDef) {
|
||||||
const name = defIfNamed ? (nameOrDef as string) : `Def${anonComponents++}`
|
const name = defIfNamed ? (nameOrDef as string) : `Def${anonComponents++}`
|
||||||
const def = defIfNamed ?? nameOrDef as TagDef
|
const def = defIfNamed ?? nameOrDef as TagDef
|
||||||
|
|
||||||
|
if (styles[name]) throw `${name} is already defined! Must use unique names.`
|
||||||
registerStyles(name, def)
|
registerStyles(name, def)
|
||||||
|
|
||||||
return (props: Record<string, any>) => {
|
return (props: Record<string, any>) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user