-
Notifications
You must be signed in to change notification settings - Fork 76
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
chore(block): add warning message when both heading & label are empty #10887
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from a few comments, this LGTM! 🌮🦃🦖
@@ -352,6 +358,14 @@ export class Block | |||
); | |||
} | |||
|
|||
private handleWarningMessage(): void { | |||
if (!this.heading && !this.label) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create a refactor issue for me to update the warnIfMissingRequiredProp
util to cover this case?
export function warnIfMissingProps<C extends LitElement>( | ||
component: C, | ||
prop: keyof C, | ||
message?: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the message argument. Messaging for required props should be consistent. If we need to provide different messaging, we could look at introducing a context
argument to help with this.
I still think we can tweak, and rename, warnIfMissingRequiredProp
to achieve this.
Related Issue: #8697
Summary
Adds warning message in console when both
heading
&label
properties are set to empty.