Rename ...props to props
This commit is contained in:
parent
a92d3e9ea2
commit
346fc7cb6c
2 changed files with 6 additions and 6 deletions
|
@ -17,7 +17,7 @@ It's
|
|||
- `nil`: Nothing is rendered.
|
||||
- `t`: Only the key is rendered.
|
||||
- non-boolean: The key/value pair is rendered.
|
||||
- `...props`: If the properties given to a component are not declared with `define-element` macro, they are gathered into `...props` property list. This allows flexible props passing to components.
|
||||
- `props`: If the properties given to a component are not declared with `define-element` macro, they are gathered into `props` property list. This allows flexible props passing to components.
|
||||
|
||||
```lisp
|
||||
(<>
|
||||
|
@ -28,7 +28,7 @@ It's
|
|||
; <div></div>
|
||||
|
||||
(define-element view-more ()
|
||||
(a ...props
|
||||
(a props
|
||||
"View More"))
|
||||
|
||||
(view-more :href "/detail" :class "m-1")
|
||||
|
@ -36,7 +36,7 @@ It's
|
|||
; <a href="/detail" class="m-1">View More</a>
|
||||
|
||||
(define-element custom-button (variant)
|
||||
(button `(:class ,variant ,@...props)
|
||||
(button `(:class ,variant ,@props)
|
||||
children))
|
||||
|
||||
(custom-button :type "submit" :variant "big" :onclick "doSomething()"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#:tag
|
||||
#:children
|
||||
#:attrs
|
||||
#:...props
|
||||
#:props
|
||||
#:attrs-alist
|
||||
#:make-attrs
|
||||
#:copy-attrs
|
||||
|
@ -223,13 +223,13 @@
|
|||
(let ,(mapcar (lambda (prop)
|
||||
(list prop `(attr attrs (make-keyword ',prop))))
|
||||
props)
|
||||
(let ((...props
|
||||
(let ((props
|
||||
(loop :for (key . value) in (attrs-alist attrs)
|
||||
:unless (member key
|
||||
',(mapcar #'make-keyword
|
||||
props))
|
||||
:append (list key value))))
|
||||
(declare (ignorable ...props))
|
||||
(declare (ignorable props))
|
||||
(progn ,@body))))))))
|
||||
(defmacro ,name (&body attrs-and-children)
|
||||
`(,',%name ,@attrs-and-children)))))
|
||||
|
|
Loading…
Reference in a new issue