-
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?
Changes from 8 commits
ff8cc9e
bb73411
1b644ed
a678c6f
d6f820b
2840e42
1d0317b
5a54861
958069b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,32 +42,15 @@ | |
padding-left: var(--horizontal-buffer); | ||
} | ||
|
||
/* Nested to prevent styles from affecting CMS header dropdown */ | ||
/* HACK: Using ID to increase specificity (until source of problem is fixed) */ | ||
/* HELP: Why does DataFilesSidebar not need such specificity? */ | ||
/* .go-to-button-dropdown { */ | ||
#go-to-button-dropdown { | ||
/* To fix menu not showing */ | ||
/* HELP: Why does DataFilesSidebar not need this fix? */ | ||
.go-to-button-dropdown { | ||
.dropdown-menu { | ||
opacity: 1 !important; | ||
pointer-events: auto !important; | ||
} | ||
/* To restyle */ | ||
.dropdown-menu { | ||
margin-top: 38px; | ||
/* To push menu down by the height of its button */ | ||
/* FAQ: Required because `tag={Button}` loses auto-position of menu */ | ||
top: 28px !important; /* to override `inset` from Popper via Reactstrap */ | ||
} | ||
.dropdown-menu::before, | ||
.dropdown-menu::after { | ||
left: 23px; | ||
margin-left: 0; | ||
} | ||
.dropdown-menu::after { | ||
top: -9px; | ||
} | ||
|
||
.dropdown-item { | ||
display: inline-block; | ||
} | ||
} | ||
|
||
|
@@ -85,12 +68,12 @@ | |
padding-left: 20px; | ||
} | ||
|
||
#go-to-button-dropdown .complex-dropdown-item-root, | ||
.complex-dropdown-item-root, | ||
.complex-dropdown-item-project { | ||
display: flex !important; | ||
display: flex; | ||
} | ||
Comment on lines
-88
to
74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
#go-to-button-dropdown .link-hover:hover { | ||
.go-to-button-dropdown .link-hover:hover { | ||
text-decoration: none; | ||
} | ||
|
||
|
wesleyboar marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why?
|
wesleyboar marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why?
Footnotes
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,5 @@ | |
|
||
.add-button-item { | ||
padding-bottom: 20px; | ||
padding-left: 20px; | ||
padding-inline: var(--global-space--section-left); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Why delete so much? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,70 +10,29 @@ | |
border-radius: 0; | ||
} | ||
|
||
#add-button-wrapper { | ||
padding-left: var(--horizontal-buffer); | ||
} | ||
#data-files-add { | ||
width: 174px; | ||
width: 100%; | ||
} | ||
Comment on lines
-13
to
15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What did I do? Match design:
|
||
|
||
.data-files-nav { | ||
padding-top: 20px; | ||
} | ||
|
||
/* Nested to prevent styles from affecting CMS header dropdown */ | ||
.data-files-sidebar { | ||
.dropdown-menu { | ||
border-color: var(--global-color-accent--normal); | ||
border-radius: 0; | ||
margin: 11px 3px 0; | ||
width: 200px; | ||
vertical-align: top; | ||
} | ||
.dropdown-menu::before { | ||
position: absolute; | ||
top: -10px; | ||
left: 67px; | ||
border-right: 10px solid transparent; | ||
border-bottom: 10px solid var(--global-color-accent--normal); | ||
border-left: 10px solid transparent; | ||
margin-left: 20px; | ||
content: ''; | ||
/* To make menu wider than button yet still centered */ | ||
width: calc(100% + var(--global-space--section-left)); | ||
left: calc( | ||
var(--global-space--section-left) / -2 | ||
) !important; /* to override `inset` from Popper via Reactstrap */ | ||
} | ||
.dropdown-menu::before, | ||
.dropdown-menu::after { | ||
top: -9px; | ||
left: 68px; | ||
border-right: 9px solid transparent; | ||
border-bottom: 9px solid #ffffff; | ||
border-left: 9px solid transparent; | ||
margin-left: 20px; | ||
content: ''; | ||
} | ||
|
||
.dropdown-item { | ||
padding: 10px 6px; | ||
color: var(--global-color-primary--x-dark); | ||
font-size: 14px; | ||
i { | ||
padding-right: 19px; | ||
font-size: 20px; | ||
vertical-align: middle; | ||
} | ||
&:hover { | ||
color: var(--global-color-primary--x-dark); | ||
} | ||
} | ||
.dropdown-item:focus, | ||
.dropdown-item:hover { | ||
/* FAQ: Before FP-1083, value was #E6E0FB, which matched Design | ||
and was `--global-color-accent` at 25% opacity on white… | ||
which is what `--global-color-accent--weak` is now */ | ||
background-color: var(--global-color-accent--weak); | ||
left: calc(50% - var(--arrow-size)); | ||
} | ||
} | ||
|
||
.complex-dropdown-item { | ||
border-top: 1px solid #707070; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why?
|
||
display: flex; | ||
} | ||
|
||
|
wesleyboar marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What did I do?
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
## Overview | ||
|
||
Refactor the styles for Data Files dropdown menus to: | ||
- share more CSS | ||
- use clearer CSS | ||
|
||
## Related | ||
|
||
* [WP-791](https://tacc-main.atlassian.net/browse/WP-791) | ||
* inspired by https://github.com/TACC/Core-Portal/pull/1018#pullrequestreview-2476250609 | ||
|
||
## Changes | ||
|
||
**`.dropdown-menu`**: | ||
- remove redundant code | ||
- use `<Dropdown>` not `<ButtonDropdown>`[^1] | ||
- clean up styles | ||
- use CSS var's for arrow and border | ||
|
||
**`DataFilesBreadcrumbs`**: | ||
- fix layout of menu and button | ||
|
||
**`DataFilesBreadcrumbs`**: | ||
- use class not ID | ||
- position via `top` not `margin-top` | ||
- explain menu position value | ||
- explain why positioning is necessary[^2] | ||
|
||
[^1]: I don't see `ButtonDropdown` in [latest ReactStrap (v9)](https://reactstrap.github.io/?path=/docs/components-dropdown--dropdown). | ||
[^2]: Not desired, but necessary if we use our custom `<Button>` as is. | ||
|
||
## Testing | ||
|
||
1. Open Data Files. | ||
2. Click "Add +" button. | ||
- Verify button is centered. | ||
- Verify menu is centered. | ||
- Verify menu is wider than button. | ||
- Verify elements are otherwise unchanged. | ||
4. Click "Go to ..." button. | ||
- Verify elements are unchanged. | ||
|
||
## UI | ||
|
||
| `DataFilesDropdown` | `DataFilesSidebar` | | ||
| - | - | | ||
| <img width="400" alt="DataFilesDropdown" src="https://github.com/user-attachments/assets/c0a35d5b-d304-4625-b94e-6ab7888ec3e4"> | <img width="400" alt="DataFilesSidebar" src="https://github.com/user-attachments/assets/7bec0d60-ec77-45d7-b53d-7c0688d8c75b"> | | ||
|
||
## Notes | ||
|
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?
dropdown-menu.css
manages.top
notmargin-top
.Margin is for space between items. Positioning uses specific properties.