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

Improve customizability of Select component #413

Merged
merged 2 commits into from
Jan 17, 2022

Conversation

bgptr
Copy link
Contributor

@bgptr bgptr commented Jan 2, 2022

decred/decrediton#3631 needs additional customization for the Select component.

This diff adds:

  • creatable select functionality
  • async select functionality
  • possibility to add custom styling

Copy link
Member

@amass01 amass01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left couple of inline comments

Comment on lines 17 to 30
style={{
content: "",
width: "0",
height: "0",
border: "0.5rem solid transparent",
borderColor:
"var(--select-anchor-color) transparent transparent transparent",
position: "absolute",
top: "-0.3rem",
right: "0.3rem",
...(props.selectProps.menuIsOpen && {
top: "-0.9rem",
borderColor:
"transparent transparent var(--color-primary) transparent",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid using inline styling, use conditioned classes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amass01, thanks for your review. I'd prefer the conditioned classes too, but with them, the arrow disappears in decrediton. The divs didn't receive the class definitions. I tried to figure out why, but only this inline styling works. Now, I revisited it without result. Do you have any idea how to solve this?

Copy link
Member

@amass01 amass01 Jan 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hrmm I'm not sure, I guess it related react-select, as the divs are wrapped with
components.DropdownIndicator. I would just leave a comment about the limitation
we can't find a solution or a workaround.

I see in the documentation that there is another classNamePrefix that might work. iirc we already
use that one.
See: https://react-select.com/styles#using-classnames

Comment on lines 11 to 15
style={{
position: "relative",
height: "100%",
width: "2rem",
}}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -27,9 +27,7 @@ const config = {
external(),
postcss({
extract: true,
modules: {
globalModulePaths: ["src/components/Select/styles.css"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering why we had this here, as src/components/Select/styles.css file didn't exist before this commit 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't exist before this commit, but it did exist before this PR.
The globalModulePaths config was introduced by: #227

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, i see, makes sense.

it was imported then as plain .css as it included pure css classes prefixed with customSelect which isn't
the case anymore, glad it evolved to a css module. 👍🏽

Copy link
Member

@amass01 amass01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

Copy link
Member

@tiagoalvesdulce tiagoalvesdulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tiagoalvesdulce tiagoalvesdulce merged commit 0ea935a into decred:master Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants