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

Replace tag components across how-to and research #3357

Open
benfurber opened this issue Mar 15, 2024 · 2 comments · May be fixed by #3400
Open

Replace tag components across how-to and research #3357

benfurber opened this issue Mar 15, 2024 · 2 comments · May be fixed by #3400

Comments

@benfurber
Copy link
Member

In components like HowToCard there's this:

...
interface IProps {
  howto: IHowtoDB & { tagList?: ITag[] }
  ...
}

return (
  ...
  {howto.tagList &&
    howto.tagList.map((tag, idx) => (
      <Tag key={idx} tag={tag} sx={{ mr: 1 }} />
    ))}
   ...

Created in HowToList:

  const howtoItems = filteredHowtos.map((howto: IHowto) => ({
    ...howto,
    tagList:
      howto.tags &&
      Object.keys(howto.tags)
        .map((key) => allTagsByKey[key])
        .filter(Boolean),
  }))

With the TagList component at src/common/Tags/TagsList.tsx created in #3356, howto.tags can be given to TagsList in HowToCard and none of this extra code is needed.

Please implement for Howtos and Research.

@simontree
Copy link

simontree commented Mar 16, 2024

Hey @benfurber - wanted to start working on this issue, but can't replicate the part with the HowToCard component as I couldn't find the code snippet you described in that corresponding current file - https://github.com/ONEARMY/community-platform/blob/master/src/pages/Howto/Content/HowtoList/HowToCard.tsx -
Could you please double check? Thx & best wishes!

@simontree
Copy link

Hey @benfurber - wanted to start working on this issue, but can't replicate the part with the HowToCard component as I couldn't find the code snippet you described in that corresponding current file - https://github.com/ONEARMY/community-platform/blob/master/src/pages/Howto/Content/HowtoList/HowToCard.tsx - Could you please double check? Thx & best wishes!

nvm - I think I found it. Should be the HowToDescription.tsx instead HowToCard.tsx, correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment