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

feat: upgrades to ember@3.24. #41

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

matthewhartstonge
Copy link
Member

converts component to glimmer.

@matthewhartstonge matthewhartstonge force-pushed the feature/ember-3-24 branch 2 times, most recently from 8e76bad to 887b4d1 Compare October 10, 2024 04:56
@@ -21,7 +21,7 @@
@value={{this.strengthValue}}
@warn={{this.strengthWarning}}
/>
<div class='flex-80'>Password Strength: {{this.strengthLevel}}</div>
<div class='flex-80'>{{this.strengthLabel}} {{this.strengthLevel}}</div>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turns out we were never setting/displaying this, even though it was an expected argument.

Comment on lines +16 to +25
this.customValidations = this.args.customValidations || A([]);
this.errors = this.args.errors || A([]);
this.minStrength = this.args.minStrength || 3;
this.onChange = this.args.onChange || null;
this.passwordErrorMessage =
this.args.passwordErrorMessage || 'Please enter a stronger password.';
this.strengthLabel = this.args.strengthLabel || 'Password strength: ';
this.strengthLevels =
this.args.strengthLevels ||
A(['Very Poor', 'Poor', 'Fair', 'Good', 'Excellent']);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided it was best to set the expected defaults for these on component creation.

It does mean that these specific arguments cannot be mutated after component creation but it feels like these would tend to be hardcoded. For example, it would be odd to dynamically change the password strength level after component creation...

Can change later if we are so inclined, or the community can make an good argument for it. ✌️

Simplifies the parsing of defaults as otherwise they all need to be computed properties which ends up with a whole lot of getters wrappers:

get passwordErrorMessage() {
  return this.args.passwordErrorMessage || 'Please enter a stronger password.';
}


inputErrors: computed('errors.[]', 'minStrength', 'passwordErrorMessage', 'passwordStrength.score', 'value', function() {
get inputErrors() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

computed properties are much cleaner now huh..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant