-
-
Notifications
You must be signed in to change notification settings - Fork 589
[6.x] Upgrade Vue Avatar component and Blade usage #12194
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
[6.x] Upgrade Vue Avatar component and Blade usage #12194
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:
cva
andtwMerge
for 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.