wevisdemo / parliament-watch

Citizens are watching 👀
https://parliamentwatch.wevis.info
Other
61 stars 33 forks source link

VotingOptionTag Component #13

Closed Th1nkK1D closed 1 year ago

Th1nkK1D commented 1 year ago

image

View Figma file

We have an old version of the component which was designed specifically for the politician's page. We want to refactor it and make it a shared component.

Starting point

Icyscools commented 1 year ago

Hi, Can I work on this?

Icyscools commented 1 year ago

Thank you for assigning me to this task. I already reviewed the task and have a question.

Do we have to consider a string value which didn't include in the DefaultVoteOption enum? Currently, it'll not be showing any text if we put a string that wasn't included in it. For example,

<VotingOptionTag voteOption={'ชื่อแคนดิเดต'} />

I'm aware that we can put a string into CustomVoteOption as a label in order to work and this question may affect the props type, but this question is directly from my curiosity since I'm not sure if we have any use cases to let this tag accept just a string.

Th1nkK1D commented 1 year ago

Do we have to consider a string value which didn't include in the DefaultVoteOption enum? Currently, it'll not be showing any text if we put a string that wasn't included in it. For example,

<VotingOptionTag voteOption={'ชื่อแคนดิเดต'} />

I'm aware that we can put a string into CustomVoteOption as a label in order to work and this question may affect the props type, but this question is directly from my curiosity since I'm not sure if we have any use cases to let this tag accept just a string.

@Icyscools the current voteOption in the component is like this

export let voteOption: DefaultVoteOption | CustomVoteOption;

So it means that voteOption can be either DefaultVoteOption or CustomVoteOption.

There is no use case of giving only a string because then the comment won't know what color they need to show. That's why colorIntensity is required following the CustomVoteOption definition in models/voting like this

export interface CustomVoteOption { 
         label: string; 
         colorIntensity: number; // 0-1 
 } 
Th1nkK1D commented 1 year ago

Merged #16