Skip to content
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

Standardize on 'card' vs. 'tile' in code #948

Closed
victorlin opened this issue Jul 9, 2024 · 2 comments · Fixed by #950
Closed

Standardize on 'card' vs. 'tile' in code #948

victorlin opened this issue Jul 9, 2024 · 2 comments · Fixed by #950
Assignees

Comments

@victorlin
Copy link
Member

victorlin commented Jul 9, 2024

also posted on Slack

The concept of "rectangular clickable box that is shown for each item in a collection" has two names across the codebase. An example is this component named FilterShowcaseTile which is defined by props and styled components with Card in the name.

const FilterShowcaseTile = ({ card }: { card: FilterCard }) => {
const setSelectedFilterOptions = useContext(SetSelectedFilterOptions);
if (!setSelectedFilterOptions) {
throw new Error("Usage of this component requires the SetSelectedFilterOptions context to be set.")
}
const filter = useCallback(
() => {
setSelectedFilterOptions(card.filters.map(createFilterOption));
goToAnchor(LIST_ANCHOR);
},
[setSelectedFilterOptions, card]
)
return (
<CardOuter>
<CardInner>
<div onClick={filter}>
<CardTitle $squashed>
{card.name}
</CardTitle>
<CardImgWrapper filename={card.img}/>
</div>
</CardInner>
</CardOuter>
)
}

We should be consistent and use just one name for this concept.

For reference, these are the current places that this concept is used:

  1. https://nextstrain.org/

    splash

  2. https://nextstrain.org/pathogens

    pathogens

  3. https://nextstrain.org/groups

    image

@victorlin victorlin self-assigned this Jul 9, 2024
@victorlin
Copy link
Member Author

I prefer 'tile' based on snippets from various answers to this UX StackExchange question:

I think of tiles as … fixed in size … and spaced out regularly along a grid.
Tiles are almost always incomplete providers of information: if you want to know anything about them, you have to interact with them.

Cards on the other hand imply that all of the relevant information are contained on them.

@victorlin
Copy link
Member Author

Side note: in #928, card represents this component, which I think is appropriate and we should keep calling that a card.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant