Skip to content

Commit

Permalink
[Components/ProfileWidget]: Allow changing default icon when no image…
Browse files Browse the repository at this point in the history
… is provided (#1290)
  • Loading branch information
dfsmania authored Jul 2, 2024
1 parent 7a9fb21 commit ef0dd26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions resources/views/components/widget/profile-widget.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<img class="img-circle elevation-2" src="{{ $img }}" alt="User avatar: {{ $name }}">
@elseif($layoutType === 'modern')
<div class="img-circle elevation-2 d-flex bg-dark" style="width:90px;height:90px;">
<i class="fas fa-3x fa-user text-silver m-auto"></i>
<i class="fa-3x {{ $icon }} text-silver m-auto"></i>
</div>
@elseif($layoutType === 'classic')
<div class="img-circle elevation-2 float-left d-flex bg-dark" style="width:65px;height:65px;">
<i class="fas fa-2x fa-user text-silver m-auto"></i>
<i class="fa-2x {{ $icon }} text-silver m-auto"></i>
</div>
@endisset
</div>
Expand Down
11 changes: 10 additions & 1 deletion src/View/Components/Widget/ProfileWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ class ProfileWidget extends Component
*/
public $img;

/**
* The default icon that will be used when no image is provided.
*
* @var string
*/
public $icon;

/**
* The profile header theme (light, dark, primary, secondary, info, success,
* warning, danger or any other AdminLTE color like lighblue or teal).
Expand Down Expand Up @@ -73,11 +80,13 @@ class ProfileWidget extends Component
*/
public function __construct(
$name = null, $desc = null, $img = null, $theme = null, $cover = null,
$headerClass = null, $footerClass = null, $layoutType = 'modern'
$headerClass = null, $footerClass = null, $layoutType = 'modern',
$icon = 'fas fa-user'
) {
$this->name = UtilsHelper::applyHtmlEntityDecoder($name);
$this->desc = UtilsHelper::applyHtmlEntityDecoder($desc);
$this->img = $img;
$this->icon = $icon;
$this->theme = $theme;
$this->cover = $cover;
$this->headerClass = $headerClass;
Expand Down

0 comments on commit ef0dd26

Please sign in to comment.