Skip to content

UI Components Library #41580

Closed
Closed

Description

@ahmaxed

Problem:

Currently our HTML and CSS consist of the followings:

  • A custom bootstrap 3 minified stylesheet injected in the head.
  • React-boostrap component library.
  • Custom styles to re-write the bootstrap styles due to changes in design style guide.

As a result, we would need to remove a lot of the unused styles, overwrites, and find a better way to manage our components.

Solution:

We should create our own component library that uses Storybook (isolate the components and document them) and tailwindCSS (style each component) and make sure they meet the web accessibility requirements.


I would roughly break the project down into smaller tasks, and the list can be adjusted as we go:


Lists were borrowed from @huyenltnguyen's comment below.

Activity

  1. added
    scope: UI
    platform: learn
    on Mar 25, 2021
  2. raisedadead commented on Mar 26, 2021

    @raisedadead
    Member

    Should this issue be consolidated back into #16445

  3. ahmaxed commented on Mar 26, 2021

    @ahmaxed
    MemberAuthor

    For that we would use stylelint which would enforce a common css style. I would keep both issues separate, but link them since they are related.

  4. prohackerzzz commented on Mar 26, 2021

    @prohackerzzz

    Can you please share some screenshots and elaborate more on this issue .I'm a newbie trying to contribute for the first time. Can you please help me??

  5. Sembauke commented on Mar 26, 2021

    @Sembauke
    Member

    Can you please share some screenshots and elaborate more on this issue .I'm a newbie trying to contribute for the first time. Can you please help me??

    Hey @prohackerzzz,
    This isn't really an issue it's rather an improvement of the codebase. You can check out the links I posted to familiarize yourself with the documentation. You may be able to contribute to this later.

  6. ahmaxed commented on Mar 30, 2021

    @ahmaxed
    MemberAuthor

    @prohackerzzz, I think once we have replaced a couple of the components, it would be easer to contribute as a first timer then.

  7. ahmaxed commented on Mar 30, 2021

    @ahmaxed
    MemberAuthor

    It seems like there is a catch with working on the components one by one.
    If we replace only one component, we would need to keep the injected bootstrap to keep the other components styled.
    That would result in writing additional bootstrap rewrites for the new component.

  8. huyenltnguyen commented on Mar 31, 2021

    @huyenltnguyen
    Member

    @ahmadabdolsaheb I guess we could just build a set of new components first, then we could do incremental migrations when we deem they are ready.

    Do we plan to use the components on other platforms too (code radio, news,...) or they will be /learn components only?

  9. pinned this issue on Apr 1, 2021
  10. gracewest333 commented on Apr 3, 2021

    @gracewest333
    Contributor

    Hi, I am also a newbie who would love to help on this issue. @huyenltnguyen I think that's a good idea to do it incrementally.

  11. ahmaxed commented on Apr 4, 2021

    @ahmaxed
    MemberAuthor

    @ahmadabdolsaheb I guess we could just build a set of new components first, then we could do incremental migrations when we deem they are ready.

    @huyenltnguyen, I think here is the plan moving forward if we are planning to do incremental migration.

    • The base styles should not be set in tailwindCSS since they include normalizers that also exits in bootstrap. ( we could add base after removing bootstrap completely)
    • Inject tailwindCSS after other stylesheets in head it rewrites other styles.( We should check the performance implications of adding tailwind while other styles are still injected)
    • Keep customizations to the minimum ( stick to defaults as much as possible which will help with maintenance down the line )
    • For every react-bootstrap component used, we should create a tailwindCSS styled storybook component.
    • Easier to migrate and commonly used components take precedence in migration over harder to migrate and less commonly used ones.
    • After couple of components are migrated and we gained more experience, we can revisit the battle plan and see if we could use scripts to speed up the migration.

    This is a great read: https://dev.to/nejremeslnici/migrating-tachyons-to-tailwind-css-part-i-ich

    Please let me what you think.

    Do we plan to use the components on other platforms too (code radio, news,...) or they will be /learn components only?
    You are asking for the storybook structure?

    Eventually we can reuse components across platforms; however, it is best to think about this component library built for learn at the moment to limit the scope of the migration.

    Coderadio has very specific UI needs and not sure how modularity would improve it. Going headless with news is in the works but the use of client technologies are not finalized yet.

    Ideally learn and news will have similar ui elements (walls of text, grid system, etc) and both could pull from storybook in the future.

  12. JoshQuaintance commented on Apr 7, 2021

    @JoshQuaintance
    Contributor

    I have worked with Storybooks before. I have used tailwind with Storybooks and Svelte, but I'm sure it can be changed into tailwind and React easily.

  13. huyenltnguyen commented on Apr 11, 2021

    @huyenltnguyen
    Member

    @ahmadabdolsaheb Thanks a lot! That sounds like a great plan. Now that it is up to us to be responsible for the components' HTML, what I would add as a criteria to our components is that they should be accessible and meet web accessibility requirements (https://www.w3.org/WAI/standards-guidelines/wcag/).

    Here is the list of components that we are pulling from @freecodecamp/react-bootstrap:

    • Alert
    • Button
    • Col
    • ControlLabel
    • DropdownButton
    • Form
    • FormControl
    • FormGroup
    • Grid
    • HelpBlock
    • Image
    • ListGroup
    • ListGroupItem
    • Media
    • MenuItem
    • Modal
    • Panel
    • Row
    • Tab
    • TabPane
    • Tabs
    • Table
    • ToggleButton
    • ToggleButtonGroup

    [edited by @ahmadabdolsaheb]: There was a list of actionable items here that was moved to the top to give contributors a better context of our progress.


    For the component to-do list, I noted them down in alphabetical order, but I'm sure you have a different order in mind with the components' priority, so please help me to adjust it. If the list misses anything please help add them in as well.

  14. 41 remaining items

  15. hamzawaleed0102 commented on Sep 22, 2021

    @hamzawaleed0102
    Contributor

    Thanks @ahmadabdolsaheb
    Let me go through the docs and get back to you on this, most probably with a draft PR.

  16. hamzawaleed0102 commented on Oct 4, 2021

    @hamzawaleed0102
    Contributor

    @ahmadabdolsaheb I enjoyed working on TS configuration for UI components library. I'm up for any other ticket.

  17. RJZauner commented on Oct 6, 2021

    @RJZauner

    Hey! I would love to help. I enjoy working with TS and love working on frontend components. Where can I help?

  18. ahmaxed commented on Oct 6, 2021

    @ahmaxed
    MemberAuthor

    @hamzawaleed0102, @RJamesMaier thank you for your interest.
    Once #43616 is reviewed and merged, we can start developing components and swapping them in the learn platform.

    Feel free to start working on a component that is listed in the issue description.

    You could gather the requirements by reviewing how each component is being used, what props are being passed, and how each DOM element is being rendered.

    Additionally make sure to review a11y best practices for each element and write tests accordingly.

    Please document the process of your research and component creation in your pr so we could add it to the issue for onboarding new contributors.

  19. RJZauner commented on Oct 6, 2021

    @RJZauner

    Awesome thank you!

  20. huyenltnguyen commented on Oct 10, 2021

    @huyenltnguyen
    Member

    Hey friends 👋

    First of all, I'm sorry for being absent for a very long time and blocking the work. Covid hit and left me with mental bumps and bruises. I will need some time to get the balance back, but will try to be more responsive here as well as in the chat.

    As @ahmadabdolsaheb mentioned, we will need to gather the specs for each component before implementing them. The requirements will be slightly different depending on the complexity of the components, but I think the following questions need to be answered overall:

    • How the component is being used in FCC apps? For example, does modal always have a header? - Knowing all the use cases allow us have a better idea on what props the component needs to support.
    • How is the component being themed? - We will need to revisit our color swatch, so having this information will be helpful in defining the color standard.
    • What is the HTML element the component renders under the hood? - This is so that we can apply the same implementation, or identify any incorrect element usage and address it in the new component. We should also pay attention to other HTML attributes (required, disabled, aria-describedby,...)
    • What HTML attributes get added/removed when the component changes its state? For example, what attributes get added to the input when it is marked required, or is disabled? - This is extended from the question above, but the attributes are not always present unless the component is in a specific state.

    I think I have more to add, but I will need to sit down to have a more comprehensive guide (this is part of the documentation task that I keep failing to commit). I know this is quite overwhelming, especially the accessibility part, but I believe this is a right thing to do. Having a11y in mind now will enables us to have better implementation approaches in the beginning, rather than trying to shift the implementation later as a11y being an after-thought. We don't need to get it right the first time, but just try to take into consideration. Btw, even Material UI can't claim that their components are 100% accessible (see this PR).

    Also, I was thinking about opening an issue for each component, so that we can keep the discussion in one place, but it's up to you guys 🙂.

    Feel free to send PRs out if you think they are ready, and perhaps /cc me in there for visibility. I will try, but I don't think I can review them in a timely fashion, and I know it is Hacktoberfest, so I don't want to ruin it for you. I'll trust the core maintainers with the decision to merge the changes. I would rather see some movements in the component library rather than leaving it stale.

    Looking forwards to your contributions. Stay safe, stay healthy, and happy coding!


    There are a lot of component libraries out there for us to use as references, I'm linking some that I find helpful for me when I need to look for component guidelines and a11y best practices:

    One interesting thing I recently found is that there are a lot of governments that have their own design system page, and they are open source ❤️ (and tax money well spent!):

  21. sitek94 commented on Oct 13, 2021

    @sitek94
    Contributor

    Hey everyone! 👋

    I've been working a bit on alert component, and I've just opened a draft PR (#43835). I would really appreciate your feedback!

  22. RJZauner commented on Oct 13, 2021

    @RJZauner

    Hi everyone!

    I got my local setup for FCC working.

    Just wanted to let you know that I will be looking at building out the toggle buttons.

  23. jtxz commented on Oct 19, 2021

    @jtxz

    I have experience building UI component libraries and would like to contribute. Are there any mocks for these components?

  24. ahmaxed commented on Oct 19, 2021

    @ahmaxed
    MemberAuthor

    @JoeTurnerIO, Thanks for your interest. The components' design and functionality should resemble the components that are used in the learn codebase. Here is an example:

    import {
    Table,
    Button,
    DropdownButton,
    MenuItem
    } from '@freecodecamp/react-bootstrap';

  25. adsingh14 commented on Oct 30, 2021

    @adsingh14

    I would like to contribute.

  26. Ismailtlem commented on Dec 26, 2021

    @Ismailtlem
    Member

    Hi guys
    I am interested in taking part in this effort, I've made a PR for the image component. Any feedback would be greatly appreciated

  27. unpinned this issue on Jan 4, 2022
  28. adsingh14 commented on Nov 11, 2022

    @adsingh14

    Donations dialog box(attached below) UI need to redesign.
    image

    Contribution: Yes

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform: learnscope: UI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions