Skip to content

Commit 9279f2b

Browse files
feat: add custom icon for table (#2)
* add custom icon for table * linting
1 parent 91686fa commit 9279f2b

File tree

12 files changed

+21
-12
lines changed

12 files changed

+21
-12
lines changed

src/NotFound/Layout/Elements/LayoutBar.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public function __construct()
1212
public function removePadding(): self
1313
{
1414
$this->properties->removePadding = true;
15+
1516
return $this;
1617
}
1718

src/NotFound/Layout/Elements/LayoutButton.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function setSticky(): self
2020

2121
public function addAlternative(string $internal, string $display_name): self
2222
{
23-
if (!isset($this->properties->alternatives)) {
23+
if (! isset($this->properties->alternatives)) {
2424
$this->properties->alternatives = [];
2525
}
2626
$this->properties->alternatives[$internal] = $display_name;

src/NotFound/Layout/Elements/Table/LayoutTable.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function __construct(bool $sort = true, bool $delete = true, bool $edit =
3030
$this->properties->sort = $sort;
3131
$this->properties->delete = $delete;
3232
$this->properties->edit = $edit;
33+
$this->properties->editIcon = 'edit';
3334
$this->properties->create = $create;
3435
}
3536

@@ -55,6 +56,13 @@ public function setTotalItems(int $number)
5556
return $this;
5657
}
5758

59+
public function setCustomEditIcon(string $iconName)
60+
{
61+
$this->properties->editIcon = $iconName;
62+
63+
return $this;
64+
}
65+
5866
public function build(): object
5967
{
6068
return (object) ['type' => $this->type, 'properties' => $this->properties];

src/NotFound/Layout/Helpers/LayoutInputDropdownHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(
2929
protected bool $required = false,
3030
) {
3131
if ($internal === null) {
32-
$internal = $model->getTable() . '_id';
32+
$internal = $model->getTable().'_id';
3333
}
3434

3535
$this->dropdown = new LayoutInputDropdown($internal, $label);

src/NotFound/Layout/Inputs/AbstractInput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace NotFound\Layout\Inputs;
44

5-
use NotFound\Layout\Elements\AbstractLayout;
65
use Illuminate\Support\Facades\Log;
6+
use NotFound\Layout\Elements\AbstractLayout;
77

88
abstract class AbstractInput extends AbstractLayout
99
{
@@ -44,7 +44,7 @@ public function setPlaceholder(string $placeholder): self
4444

4545
public function setValue(mixed $value): self
4646
{
47-
if (!is_string($value)) {
47+
if (! is_string($value)) {
4848
$this->abortLogSetValueError('AbstractInput', 'string', $value);
4949
}
5050
$this->value = $value;

src/NotFound/Layout/Inputs/LayoutInputCheckbox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class LayoutInputCheckbox extends AbstractInput
1010

1111
public function setValue($value): self
1212
{
13-
if (!is_bool($value)) {
13+
if (! is_bool($value)) {
1414
$this->abortLogSetValueError('InputCheckbox', 'boolean', $value);
1515
}
1616
$this->value = $value;

src/NotFound/Layout/Inputs/LayoutInputDropdown.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function setSearchable(): self
2424

2525
public function addItem($value, $readableValue = null): self
2626
{
27-
trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
27+
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
2828

2929
return $this->addOption($value, $readableValue);
3030
}

src/NotFound/Layout/Inputs/LayoutInputFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class LayoutInputFile extends AbstractInput
1010

1111
public function setValue($value): self
1212
{
13-
if (!is_object($value)) {
13+
if (! is_object($value)) {
1414
$this->abortLogSetValueError('LayoutInputImage', 'object', $value);
1515
}
1616
$this->value = $value;

src/NotFound/Layout/Inputs/LayoutInputImage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class LayoutInputImage extends AbstractInput
1010

1111
public function setValue($value): self
1212
{
13-
if (!is_object($value)) {
13+
if (! is_object($value)) {
1414
$this->abortLogSetValueError('LayoutInputImage', 'object', $value);
1515
}
1616
$this->value = $value;

src/NotFound/Layout/Inputs/LayoutInputTags.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class LayoutInputTags extends AbstractInput
1919
*/
2020
public function setValue(mixed $value): self
2121
{
22-
if (!is_array($value)) {
22+
if (! is_array($value)) {
2323
$this->abortLogSetValueError('InputTags', 'array', $value);
2424
}
2525
$this->value = $value;
@@ -50,7 +50,7 @@ public function addOption($value, $readableValue = null): self
5050

5151
public function addItem($value, $readableValue = null): self
5252
{
53-
trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
53+
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);
5454

5555
return $this->addOption($value, $readableValue);
5656
}

0 commit comments

Comments
 (0)