graasp / graasp/graasp-ui

Refactor status chips into multiple variants of single base chip

Open
#873 0 comments 0 reactions 0 assignees View on GitHub
apps :iphone: refactor
Dominant language
TypeScript
Stars
4
Forks
2
PR merge metrics
No merged PRs in 30d

Description

> Nice PR ! It looks good to me 🚀. I just have a question: do you think it could be interesting to have a StatusChip component who have the same props as the others, but with a colour and an icon in addition ? This could allows to reuse this component inside Required, Saved and SubmittedChip component and reducing the little code duplication. Maybe it is not what we want, it is just a question 😉.

_Posted by @ReidyT_

> @ReidyT @swouf I agree, we could have a single component that exposes a `variant` prop that could take the `required | submitted | saved` values and then simply switch on them in the component. The structure could be the same and you only have to switch on the color and icon properties. You can put them in a dictionary that indexes over the custom chip variant.

But as Thibault has said, do this only if re-use is important.

_Originally posted by @spaenleh in https://github.com/graasp/graasp-ui/pull/872#pullrequestreview-2076877855_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the StatusChip, RequiredChip, SavedChip, and SubmittedChip components and reading their current props and structure. Refactor only if reuse is valuable, with one base component exposing required, submitted, and saved variants that select the appropriate color and icon; done means the three existing chip components reuse it without changing their behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.