Allow some customization in AnnotationTimestamps edited text #73
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of https://github.com/orgs/hypothesis/projects/156/views/2?pane=issue&itemId=124121878
Enhance
withEditedTimestampprop inAnnotationTimestampscomponent, so that it allows a variant name to be passed, customizing the "edited" text.It still allows
falseandtruevalues, which continue behaving the same (trueis now equivalent to using the "default" variant).TL;DR
This change is needed so that we can display more prominent "edited" texts in the moderation queue. I considered other options, like allowing classes to be passed, but that required an extra prop which was only relevant if
withEditedTimestampistrue, or passing a list of classes to that prop, which I reckon is less intuitive than a variant name.I also considered extracting that piece into its own component, which in turn allows
classesto be provided, and let consumers compose with individual components as desired. However, the logic to render that piece is too coupled with otherAnnotationTimestampsinternal details, causing some duplication or having to expose too many of those details.With that in mind I ended up with this approach, which is a bit less flexible, but very simple. We can add more variants in future if needed.