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

Added DataSearchCountWidget #752

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Added DataSearchCountWidget #752

wants to merge 1 commit into from

Conversation

apepper
Copy link
Contributor

@apepper apepper commented Feb 12, 2025

Inspired by parts of SearchResultsWidget.

Inspired by party of SearchResultsWidget.
@apepper apepper requested a review from dcsaszar February 12, 2025 13:44
@dcsaszar dcsaszar self-assigned this Feb 12, 2025
Copy link
Contributor

@dcsaszar dcsaszar left a comment

Choose a reason for hiding this comment

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

Good so far. Some ideas in comments.

Comment on lines +34 to +50
[
'headline0',
(headline) =>
!headline && {
severity: 'warning',
message: 'The headline for 0 results should be set.',
},
],
[
'headline1',
(headline) =>
!headline && {
severity: 'warning',
message: 'The headline for 1 result should be set.',
},
],
],
Copy link
Contributor

Choose a reason for hiding this comment

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

  •  FYI as the component is happy and fully functioning without h0 and h1 we could drop these warnings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I remember how added the code originally 🙄: 1ec43ee#diff-bc72c026851dc07f2844efe663f800f856d2c52f02407caf602d951ad88fa353R42-R74

I think the validation is useful. Yes, you can leave the attribute empty, but then nothing is shown at all.

import { EditorNote } from '../../Components/EditorNote'

provideComponent(DataSearchCountWidget, ({ widget }) => (
<h1 className="h3 text-center">
Copy link
Contributor

@dcsaszar dcsaszar Feb 12, 2025

Choose a reason for hiding this comment

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

  • Why is this an H1? Looks like a potential SEO pitfall. <h3 className="text-center">?
  • FYI In general it's sad that we don't enable editors to show the result in any widget with any style they want. E.g., always-centered will not work for sites that use left-aligned headings. It would be great to have, e.g., a conditional widget that can operate on the result count, show different widgets depending on the value, and use a placeholder to show the value. Maybe a DataCountHeadlineWidget would be a sensible compromise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the options style, level and alignment. This hopefully helps to use it in more situations.

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.

2 participants