Skip to content

Small refactor of CardAge#15616

Draft
domlander wants to merge 1 commit intomainfrom
doml/refactor-card-age
Draft

Small refactor of CardAge#15616
domlander wants to merge 1 commit intomainfrom
doml/refactor-card-age

Conversation

@domlander
Copy link
Copy Markdown
Contributor

@domlander domlander commented Mar 30, 2026

What does this change?

Refactor card age. No longer need to pass in isTagPage to Card component.

Why?

To make the code easier to work with. Props should ideally describe the behaviour of the component, not the characteristics of the parent. They scale much better when following this practice. Card is used widely and often touched.

For example, if I want to call Card from a new component, when considering card age:

  • BEFORE: I can use the showAge prop, but I would need to add extra logic to the component to choose between displaying time relatively or absolutely. I would maybe need to add another prop if my new component does not fall into the existing buckets of front page or tag page.
  • AFTER: I can use the props available: showAge and ageFormat to choose whether to show the age and the format. No changes to the Card component would be needed.

@domlander domlander self-assigned this Mar 30, 2026
@domlander domlander added run_chromatic Runs chromatic when label is applied fronts + curation maintenance Departmental tracking: maintenance work, not a fix or a feature labels Mar 30, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Mar 30, 2026
@domlander domlander force-pushed the doml/refactor-card-age branch from 18f20b5 to 152cfc6 Compare March 30, 2026 16:28
@domlander domlander added the run_chromatic Runs chromatic when label is applied label Mar 30, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Mar 30, 2026
@domlander domlander force-pushed the doml/refactor-card-age branch from 152cfc6 to f2dbc7b Compare March 30, 2026 16:55
@domlander domlander added the run_chromatic Runs chromatic when label is applied label Mar 30, 2026
@github-actions github-actions bot removed the run_chromatic Runs chromatic when label is applied label Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fronts + curation maintenance Departmental tracking: maintenance work, not a fix or a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant