-
Notifications
You must be signed in to change notification settings - Fork 19
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
base: main
Are you sure you want to change the base?
Conversation
Inspired by party of SearchResultsWidget.
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.
Good so far. Some ideas in comments.
[ | ||
'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.', | ||
}, | ||
], | ||
], |
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.
- FYI as the component is happy and fully functioning without h0 and h1 we could drop these warnings.
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.
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"> |
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.
- 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.
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.
I added the options style
, level
and alignment
. This hopefully helps to use it in more situations.
Inspired by parts of SearchResultsWidget.