Skip to content

Display all variations of format#14293

Merged
JamieB-gu merged 3 commits intomainfrom
display-all-variations-of-format
Jul 29, 2025
Merged

Display all variations of format#14293
JamieB-gu merged 3 commits intomainfrom
display-all-variations-of-format

Conversation

@JamieB-gu
Copy link
Contributor

It's useful to be able to see all the possible values of format, for reference, rather than just a few examples.

Part of #13737.

@JamieB-gu JamieB-gu requested review from a team and Copilot July 28, 2025 12:35
@github-actions
Copy link

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

This comment was marked as outdated.

@github-actions
Copy link

github-actions bot commented Jul 28, 2025

It's useful to be able to see all the possible values of format, for
reference, rather than just a few examples.
@JamieB-gu JamieB-gu force-pushed the display-all-variations-of-format branch from 3965d16 to 2dfd553 Compare July 28, 2025 12:37
@github-actions
Copy link

github-actions bot commented Jul 28, 2025

Prompted by a suggestion from GitHub Copilot's PR review.
@JamieB-gu JamieB-gu added the run_chromatic Runs chromatic when label is applied label Jul 28, 2025
@JamieB-gu JamieB-gu requested a review from Copilot July 28, 2025 13:02
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Jul 28, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the documentation by displaying all possible format values for article formats instead of just providing examples. It introduces a utility function to extract enum values and dynamically shows all available options for Design, Display, and Theme.

  • Adds imports for article format enums (ArticleDesign, ArticleDisplay, ArticleSpecial, Pillar)
  • Creates a formatValues utility function to extract string values from TypeScript enums
  • Updates documentation descriptions to show complete lists of format values instead of examples
Comments suppressed due to low confidence (1)

dotcom-rendering/src/devServer/docs/article.tsx:109

  • The parameter name 'a' is ambiguous and unclear. Consider renaming it to something more descriptive like 'enumObject' or 'enumType'.
const formatValues = (a: object): string =>

*
* https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings
*/
const formatValues = (a: object): string =>
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

The parameter type 'object' is too generic. Consider using a more specific type constraint like 'Record<string, string | number>' to better reflect that this function expects enum objects.

Suggested change
const formatValues = (a: object): string =>
const formatValues = (a: Record<string, string | number>): string =>

Copilot uses AI. Check for mistakes.
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 that this is a fair comment, although if we're going to opt for a narrower type then it's probably preferable to use the specific enums this function was designed for, which I've done in 0679c61. This function isn't intended to be used for all Records (or objects), just for these four enums.

Prompted by a suggestion from GitHub Copilot's PR review.
@JamieB-gu JamieB-gu added the run_chromatic Runs chromatic when label is applied label Jul 28, 2025
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Jul 28, 2025
@JamieB-gu JamieB-gu merged commit 52278ca into main Jul 29, 2025
31 checks passed
@JamieB-gu JamieB-gu deleted the display-all-variations-of-format branch July 29, 2025 13:39
@prout-bot
Copy link

Seen on PROD (merged by @JamieB-gu 13 minutes and 41 seconds ago) Please check your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants