[6.x] Upgrade Vue Avatar component and Blade usage#12194
[6.x] Upgrade Vue Avatar component and Blade usage#12194jasonvarga merged 16 commits intostatamic:masterfrom
Conversation
|
We'll get this cleaned up and moved into the UI library. Good one to have I think. 👍 Thanks! |
|
I also noticed where the So in the user listing, it's still |
|
When you import the component, the convention is uppercase. |
|
Would it be nicer to support passing the ID or email in addition to (or instead of) the whole user object? <avatar :user='{{ $user->id }}' />
<avatar :user='{{ $user->email }}' />
<avatar :user='@json($user)' /><avatar :id="user.id" />
<avatar :email="user.email" />
<avatar :user /> |
|
That’s not a silly idea: but more of a case of needs to be either the user object, or the name. This would mean it could be used for use cases with non-Statamic users with greater ease as it has more intelligence. Perhaps if these props are provided, what is the order of priority? What value would ID or email have? The component could look up the user object: but not sure if that’s really needed or warranted. |
# Conflicts: # resources/views/components/avatar.blade.php
|
Alrighty, cleaned this up. You can use it globally with It accepts a <ui-avatar :user="{
name: 'John Doe',
initials: 'JD',
avatar: '/avatar.png'
}" />We can always add the other props (email, id, etc) in the future. |
The new Avatar in the top right of the CP looks great - but is only in Blade.
This PR updates the existing Vue Avatar component with:
cvaandtwMergefor clean styles and 'types' (i.e. Avatar or Initials)This also revises the User Listing to better use the new styles.
Given how seamlessly Vue components can work from a Blade view, I've (maybe questionably?) removed the Blade component as with this PR, it no longer is being used.
Ideally, exposing this Vue Avatar to the UI library (see Idea 1360) would be awesome to allow addon devs to take advantage of a centralised appearance for Avatars... but not 100% sure how to approach that with the new setup.