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

chore(block): add warning message when both heading & label are empty #10887

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

anveshmekala
Copy link
Contributor

Related Issue: #8697

Summary

Adds warning message in console when both heading & label properties are set to empty.

@github-actions github-actions bot added the chore Issues with changes that don't modify src or test files. label Nov 26, 2024
@anveshmekala anveshmekala added the skip visual snapshots Pull requests that do not need visual regression testing. label Nov 26, 2024
@anveshmekala anveshmekala marked this pull request as ready for review November 26, 2024 22:43
Copy link
Member

@jcfranco jcfranco left a 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! 🌮🦃🦖

packages/calcite-components/src/components/block/block.tsx Outdated Show resolved Hide resolved
packages/calcite-components/src/components/block/block.tsx Outdated Show resolved Hide resolved
@@ -352,6 +358,14 @@ export class Block
);
}

private handleWarningMessage(): void {
if (!this.heading && !this.label) {
Copy link
Member

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,
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issues with changes that don't modify src or test files. skip visual snapshots Pull requests that do not need visual regression testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants