Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions src/Map/src/Icon/Icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ protected function __construct(
protected IconType $type,
protected int $width = 24,
protected int $height = 24,
protected ?string $color = null, // Nouvelle propriété pour la couleur
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment does not bring any value

Suggested change
protected ?string $color = null, // Nouvelle propriété pour la couleur
protected ?string $color = null,

) {
}

Expand Down Expand Up @@ -88,6 +89,20 @@ public function height(int $height): static
return $this;
}

/**
* Sets the color of the icon.
* Note: This only has an effect on SvgIcon and UxIcon types when rendered client-side by the JavaScript controller.
* The color should be a valid CSS color string (e.g., 'red', '#FF0000', 'rgb(255,0,0)').
Comment on lines +94 to +95
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Note: This only has an effect on SvgIcon and UxIcon types when rendered client-side by the JavaScript controller.
* The color should be a valid CSS color string (e.g., 'red', '#FF0000', 'rgb(255,0,0)').
* Must be a valid CSS color (e.g.: 'red', '#FF0000', 'rgb(255,0,0)'). Only affects UX Icon or SVG icons.

*
* @param non-empty-string $color
*/
public function color(string $color): static
{
$this->color = $color;

return $this;
}

/**
* @internal
*/
Expand All @@ -97,14 +112,15 @@ public function toArray(): array
'type' => $this->type->value,
'width' => $this->width,
'height' => $this->height,
'color' => $this->color, // Ajout de la couleur au tableau de sérialisation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment does not bring any value

Suggested change
'color' => $this->color, // Ajout de la couleur au tableau de sérialisation
'color' => $this->color,

];
}

/**
* @param array{ type: value-of<IconType>, width: positive-int, height: positive-int }
* &(array{ url: non-empty-string }
* |array{ html: non-empty-string }
* |array{ name: non-empty-string }) $data
* @param array{ type: value-of<IconType>, width: positive-int, height: positive-int, color?: string }
* &(array{ url: non-empty-string }
* |array{ html: non-empty-string }
* |array{ name: non-empty-string }) $data
*
* @internal
*/
Expand Down
Loading