-
Notifications
You must be signed in to change notification settings - Fork 125
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
refactor: simplify avatar and smallNameAndAvatar components #748
base: main
Are you sure you want to change the base?
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Overall I like the change. There are two things I don't like here:
|
Yes that's the whole plan here: we pass the |
Contrary to a regular component like a Vue file (for instance, Index.vue or similar), a component like Avatar is ... a Component, and not a page. A component like Avatar.vue is a tool. And because it's a tool, it needs a set of props to indicate to developers what it needs to work how it's supposed to work. If the prop that we require is an object like Employee, it's way too big. The developer will not know how this object is used, and therefore, will not know what it should give the tool to properly function. So every time, it will have to read the Avatar.vue file to understand that it needs a name, an URL and an image - and nothing else. And if the developer needs more info, he just takes a look at the props in the component. Moreover, a tool like Avatar.vue should not know that it needs an Employee object. In fact it doesn't. By indicating what exact props the component needs, I think it's much easier for the dev to know how to use the component. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@djaiss I've made changes, what do you think? |
This PR aims at make the Avatar and SmallNameAndAvatar component take a
member
, and display the avatar/the name/with the url, depending on the properties of themember
object.It simplifies the behavior on the parent component.
Another goal was to replace the
navigateTo
method of the Avatar by a real link, with allow the user to right click > open in a new tab.You fool, don't forget these steps: