-
Notifications
You must be signed in to change notification settings - Fork 23
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
"Contributors" styles #355
Comments
Maybe it should be a custom block that uses the contributors API endpoint? (like core does for /credits.php) |
I could get behind that idea... With something like credits, it seems like we'd want the list of names to actually be inserted into the post content, instead of it being a dynamic block whose output comes from PHP. This would be beneficial because A) the results would be cached in post content, so less calls to the API, and B) the names would still be there if the API ever changed. But maybe the block would have UI in the editor for "refreshing" the name list, if e.g. the contributor list gets updated later, which would remove and replace the list of names with the results of a new API call (although I guess you could just remove the block and re-add it?) |
🤔 It looks like it might not be possible to use the API endpoint for every release post. The problem is that the API only stores credits data for major releases, and treats minor releases as having the same set of contributors. So the credits list for 5.9.0 and for 5.9.x are the same. Currently in release posts on the News site, minor versions, betas, and RCs only give props to the contributors who contributed for that particular release, rather than the entire major version. I also learned that the HTML list of contributors that currently gets pasted into release posts is generated by a bin script that exists on wporg sandboxes, and basically parses a git log to find all the users. I don't think there's a good way to automate that at this point. So, I think we're back to either creating a custom style for the Paragraph block, or creating a simple "Props" block. Given that the list of names still has to get generated from a script, whether or not its marked up with HTML or not, a custom style seems like the best choice. |
Ok, I wasn't thorough enough in my investigation before. Some release posts use a So we may be able to make a block version of that shortcode. But I think the first step is to register some block styles on the paragraph block that will apply a class like |
We added a |
Oh yeah, they get a |
Ah, I see 👍🏻 |
The way the design is now, the usernames are supposed to have a dot/bullet between each one. This could be accomplished with something like an One way to visually fix it might be to have the paragraph text be the same color as the background, so it's essentially hidden, and then have anchor tags within the paragraph have the correct (white) text color. Then the only weirdness would be at the end of the list of props where the last username is prefixed with an "and", so there would be kind of a big gap between the last two items. Another potential fix would be to change the output of the shortcode to not have commas or the final "and" (maybe change it to a bulleted list that we can then style so list items are inline?), but that wouldn't address older posts that have the script-generated list. Thoughts @beafialho @iandunn ? |
What about adding a shortcode argument, so |
I like that better, since the text/background match feels pretty hacky and might be misinterpreted as spam by search engines. The shortcode could also take a bool arg that determines whether or not the "and" is added. Those new args could add classes to the containing IMO it's fine to leave older posts alone, but I don't feel strongly. |
This also seems better to me because of the hacky/spam point noted by @iandunn. I'd like to use |
Adds `class` and `separator` attributes to the shortcode callback function so that the string of props names can better be styled to match the new design for the WordPress.org News site. The defaults for these attributes are set so that all existing uses of the shortcode on the News site will be able to match the design without having to go back and edit a lot of posts. See WordPress/wporg-news-2021#355
Registers some block styles and adds related rules to the stylesheet to match the design for "Contributors" blocks. In some release posts (major releases), the [wpcredits] shortcode is used, which can't have the block styles applied to it, so there's a separate PR to add the correct classes to the container that it renders. For other release posts (minor releases), the list of props is usually generated via a script and pasted into a paragraph or code block. For these, the block style can be applied manually to be able to match the design. Note that the design calls for the props block to be full width. It seemed to make more sense to just have the post author add the additional alignfull class to the block, rather than trying to match the same full width styles with another class name. Fixes #355
After merging #363 and updating the shortcode, here's what the three sizes of contributor blocks look like in action:
cc @beafialho |
Uh oh, I realized now I missed this ping @coreymckrill... All these sizes are looking great. Thank you all for your hard work on this! |
The design specifies color and font size that depends on how long the list of contributors is:
It appears (for the 5.9 release anyway) that the list of contributors is just output in a single paragraph block. So perhaps these three "breakpoint" styles should just be implemented as block variations for the paragraph block?
The text was updated successfully, but these errors were encountered: