Nest function parameters into objects
This commit is contained in:
parent
e5fddf7a7d
commit
dedf7886e5
1 changed files with 12 additions and 12 deletions
|
@ -67,7 +67,7 @@ export function App(game)
|
|||
},
|
||||
[
|
||||
Board,
|
||||
game.board
|
||||
{ board: game.board }
|
||||
],
|
||||
[
|
||||
"div",
|
||||
|
@ -83,13 +83,13 @@ export function App(game)
|
|||
/**
|
||||
* Renders an element which represents the specified {@link board `board`}.
|
||||
*
|
||||
* @param {Board} board
|
||||
* @param {{ board: Board }} board
|
||||
* The board represented in this element.
|
||||
*
|
||||
* @returns {NodeDescriptor}
|
||||
* The rendered element.
|
||||
*/
|
||||
export function Board(board)
|
||||
export function Board({ board })
|
||||
{
|
||||
let fields = board.flatMap((row) => row);
|
||||
|
||||
|
@ -99,7 +99,7 @@ export function Board(board)
|
|||
...fields.map(
|
||||
(field) =>
|
||||
{
|
||||
return /** @type {NodeDescriptor} */([Field, field]);
|
||||
return /** @type {NodeDescriptor} */([Field, { field }]);
|
||||
}),
|
||||
["div", { style: "clear: both;" }]
|
||||
];
|
||||
|
@ -108,13 +108,13 @@ export function Board(board)
|
|||
/**
|
||||
* Renders an element which represents the specified {@link field `field`}.
|
||||
*
|
||||
* @param {CellOwner} field
|
||||
* @param {{ field: CellOwner }} field
|
||||
* The field to represent.
|
||||
*
|
||||
* @returns {NodeDescriptor}
|
||||
* The rendered element.
|
||||
*/
|
||||
export function Field(field)
|
||||
export function Field({ field })
|
||||
{
|
||||
return [
|
||||
"div",
|
||||
|
@ -143,23 +143,23 @@ export function MenuBar()
|
|||
return [
|
||||
"div",
|
||||
{ className: "menu-bar" },
|
||||
[Button, ["New Game", { className: newGameClass }]],
|
||||
[Button, ["Save Game", { className: saveGameClass }]],
|
||||
[Button, ["Load Game", { className: loadGameClass }]],
|
||||
[Button, ["Undo Last Move", { className: undoClass }]]
|
||||
[Button, { content: ["New Game", { className: newGameClass }] }],
|
||||
[Button, { content: ["Save Game", { className: saveGameClass }] }],
|
||||
[Button, { content: ["Load Game", { className: loadGameClass }] }],
|
||||
[Button, { content: ["Undo Last Move", { className: undoClass }] }]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a button.
|
||||
*
|
||||
* @param {...ElementDescriptor[1][]} content
|
||||
* @param {{ content: ElementDescriptor[1][] }} content
|
||||
* The settings of the button.
|
||||
*
|
||||
* @returns {NodeDescriptor}
|
||||
* The rendered element.
|
||||
*/
|
||||
export function Button(content)
|
||||
export function Button({ content })
|
||||
{
|
||||
return [
|
||||
"button",
|
||||
|
|
Loading…
Reference in a new issue