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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃Ч Refactor: Modularize Buttons #218

Open
EDWIN1669086 opened this issue Jan 17, 2024 · 0 comments
Open

馃Ч Refactor: Modularize Buttons #218

EDWIN1669086 opened this issue Jan 17, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@EDWIN1669086
Copy link
Collaborator

EDWIN1669086 commented Jan 17, 2024

Context

Right now, all the buttons used in the learning lab are coded as raw HTML buttons.

Problem

In React, the idea is to wrap commonly used elements as a component since it is easier to read, test, and make changes. Also, we are using one-line css attributes that are not necessary.
Screenshot 2024-01-16 at 5 09 27鈥疨M

Proposed Solution

The idea is to have a button component as follows:

<CustomButton backgroundColor="some-color" hoverColor="#9500ae">Click me!</CustomButton>

Note that you'll have to use the .shared-button class, remove the other CSS one-liners, and then inline-style for the correct background color and hover color. For completeness sake, also add an optional disabled prop (defaulted false) so that we can use this component within the KhanCard and FinishCard. Besides those "Check" buttons, the other button usage places are as follows:

  • Excursion 2, Understand the Problem ("Play")
  • Excursion 3, Understand the Problem ("Next")
  • Problem4.tsx ("Next")
  • BinarySearchExample.tsx ("Lower", "Higher")

Also note that it would be best if you support not only "#[some-alpha-numeric-characters]" but also the generic colors, such as "red", "orange", "yellow", "green", "blue", "purple" as CSS would define them. In other words, both the propr backgroundColor and hoverColor should support a hex code string as well as a regular color name string (Think of using a map). This makes the programmers' life easier so they don't have to find the hex code for a simple color every time.


This is a 馃Ч Refactor Request

@EDWIN1669086 EDWIN1669086 assigned clarej12 and maxinewu5 and unassigned clarej12 Jan 17, 2024
@EDWIN1669086 EDWIN1669086 added the enhancement New feature or request label Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants