-
Notifications
You must be signed in to change notification settings - Fork 0
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
refactor: wp-791 dropdown menu #1028
base: main
Are you sure you want to change the base?
Conversation
- remove most of the redundant code - use Dropdown not ButtonDropdown - fix layout of menu and button in DataFilesSidebar - clean up our .dropdown-menu styles - use variables for arrow and border
`….scss`: - use class not ID - position via `top` not `margin-top` - explain menu position's "magic" value - explain why positioning is necessary[^1] `….jsx`: - use class not ID use Dropdown not ButtonDropdown[^2] [^1]: Not desired, but necessary if we use our custom <Button> as is. [^2]: I don't see ButtonDropdown in latest ReactStrap (v9).
This class is assigned to buttons that: - **either** have Bootstrap btn-primary (in which case the `.workbench-content .btn-primary` styles it) - **or** are our custom `<Button>` (in which case the `composes: c-button` styles it)
This reverts commit 1b644ed.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1028 +/- ##
=======================================
Coverage 72.88% 72.88%
=======================================
Files 534 534
Lines 33455 33455
Branches 2981 2981
=======================================
Hits 24385 24385
Misses 8875 8875
Partials 195 195
Flags with carried forward coverage won't be shown. Click here to find out more.
|
#go-to-button-dropdown .complex-dropdown-item-root, | ||
.complex-dropdown-item-root, | ||
.complex-dropdown-item-project { | ||
display: flex !important; | ||
display: flex; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What did I do?
- Use class not ID.
- Remove unnecessary styles.
- Remove styles that
dropdown-menu.css
manages. - Position via
top
notmargin-top
.
Margin is for space between items. Positioning uses specific properties.
client/src/components/DataFiles/DataFilesDropdown/DataFilesDropdown.jsx
Outdated
Show resolved
Hide resolved
client/src/components/DataFiles/DataFilesSidebar/DataFilesSidebar.jsx
Outdated
Show resolved
Hide resolved
padding-left: 20px; | ||
padding-inline: var(--global-space--section-left); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#add-button-wrapper { | ||
padding-left: var(--horizontal-buffer); | ||
} | ||
#data-files-add { | ||
width: 174px; | ||
width: 100%; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What did I do? Match design:
- Stretch the button.
- Center the button.
} | ||
} | ||
|
||
.complex-dropdown-item { | ||
border-top: 1px solid #707070; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
- Replaced by
<DropdownItem divider>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why delete so much?
Most of the dropdown menu styles are in dropdown-menu.css
thus are redundant here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
- Latest Reactstrap does not document
ButtonDropdown
; it might be deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
- Don't use wrappers (cruft) unless necessary.
- Latest Reactstrap does not document
ButtonDropdown
; it might be deprecated. - Use
<DropdownItem divider />
likeDataFilesDropdown
does.
If we're gonna use Reactstrap, let's use it as designed (until we replace it).1
Footnotes
-
A more recent guideline I follow, cuz it's easier to reference an API than search for "what we normally do". ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What did I do?
- Add variables so arrow math is documented via code.
- Style
<DropdownItem divider>
. - Clarify code with whitespace or comments.
Overview
Refactor the styles for Data Files dropdown menus to:
Related
Changes
.dropdown-menu
:<Dropdown>
not<ButtonDropdown>
1.dropdown-divider
like.complex-dropdown-item
DataFilesSidebar
:<DropdownItem divider>
likeDataFilesBreadcrumbs
DataFilesBreadcrumbs
:top
notmargin-top
Testing
UI
…Dropdown
A…Dropdown
B…Sidebar
Notes
Footnotes
I don't see
ButtonDropdown
in latest ReactStrap (v9). ↩Not desired, but necessary if we use our custom
<Button>
as is. ↩