From cd0d74a4b1d050625f7f67e9ce50f7abee77afb8 Mon Sep 17 00:00:00 2001 From: paku Date: Mon, 15 Apr 2024 19:31:09 +0900 Subject: [PATCH] Change ...props from alist to plist --- README.md | 5 ++--- src/elements.lisp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5bd71ad..5666a00 100644 --- a/README.md +++ b/README.md @@ -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` 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 (<> @@ -36,8 +36,7 @@ It's ; View More (define-element custom-button (variant) - (button `((:class . ,variant) - ,@...props) + (button `(:class ,variant ,@...props) children)) (custom-button :type "submit" :variant "big" :onclick "doSomething()" diff --git a/src/elements.lisp b/src/elements.lisp index 69adf90..1f8c6bf 100644 --- a/src/elements.lisp +++ b/src/elements.lisp @@ -218,7 +218,7 @@ :unless (member key ',(mapcar #'alx:make-keyword props)) - :collect (cons key value)))) + :append (list key value)))) (declare (ignorable ...props)) (progn ,@body)))))))) (defmacro ,name (&body attrs-and-children)