Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow changing icon on ProfileWidget component #1290

Merged
Merged
Show file tree
Hide file tree
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
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