The individual check UI elements should be in their own component. Either make specialized components that know the rule to apply and then simply pass the password, or make a general component that receives either the validation function or the result of said validation function and then simply change in color.
I’m a software developer from planet earth with multi-cultural background and various technical skills. I consider myself as an old coder with a lot of experience.
I'm not sure it's worth it to separate in individual components for each check for such a small piece of code : we loose the global readability of the rules to apply to the password.
Separating them provides the ability to create different rules for different passwords. Most systems require only one password, but a few might require different passwords with different restrictions. Furthermore, if this ultimately were encapsulated in a library, for it to be the most effective cannot impose a fixed set of password rules. It needs to be versatile.
I’m a software developer from planet earth with multi-cultural background and various technical skills. I consider myself as an old coder with a lot of experience.
The individual check UI elements should be in their own component. Either make specialized components that know the rule to apply and then simply pass the password, or make a general component that receives either the validation function or the result of said validation function and then simply change in color.
Still, it is a nice UI for password setting.
I'm not sure it's worth it to separate in individual components for each check for such a small piece of code : we loose the global readability of the rules to apply to the password.
Separating them provides the ability to create different rules for different passwords. Most systems require only one password, but a few might require different passwords with different restrictions. Furthermore, if this ultimately were encapsulated in a library, for it to be the most effective cannot impose a fixed set of password rules. It needs to be versatile.
totally agree for this contexts it makes sense :)