Change ...props from alist to plist
This commit is contained in:
parent
32a21fa684
commit
cd0d74a4b1
2 changed files with 3 additions and 4 deletions
|
@ -17,7 +17,7 @@ It's
|
||||||
- `nil`: Nothing is rendered.
|
- `nil`: Nothing is rendered.
|
||||||
- `t`: Only the key is rendered.
|
- `t`: Only the key is rendered.
|
||||||
- non-boolean: The key/value pair 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` association 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
|
```lisp
|
||||||
(<>
|
(<>
|
||||||
|
@ -36,8 +36,7 @@ It's
|
||||||
; <a href="/detail" class="m-1">View More</a>
|
; <a href="/detail" class="m-1">View More</a>
|
||||||
|
|
||||||
(define-element custom-button (variant)
|
(define-element custom-button (variant)
|
||||||
(button `((:class . ,variant)
|
(button `(:class ,variant ,@...props)
|
||||||
,@...props)
|
|
||||||
children))
|
children))
|
||||||
|
|
||||||
(custom-button :type "submit" :variant "big" :onclick "doSomething()"
|
(custom-button :type "submit" :variant "big" :onclick "doSomething()"
|
||||||
|
|
|
@ -218,7 +218,7 @@
|
||||||
:unless (member key
|
:unless (member key
|
||||||
',(mapcar #'alx:make-keyword
|
',(mapcar #'alx:make-keyword
|
||||||
props))
|
props))
|
||||||
:collect (cons key value))))
|
:append (list key value))))
|
||||||
(declare (ignorable ...props))
|
(declare (ignorable ...props))
|
||||||
(progn ,@body))))))))
|
(progn ,@body))))))))
|
||||||
(defmacro ,name (&body attrs-and-children)
|
(defmacro ,name (&body attrs-and-children)
|
||||||
|
|
Loading…
Reference in a new issue