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

Components/dropdown #1065

Closed
wants to merge 14 commits into from
Closed

Components/dropdown #1065

wants to merge 14 commits into from

Conversation

julio8a
Copy link
Contributor

@julio8a julio8a commented Mar 20, 2019

Updated dropdowns UI (styles)

from #1021

@julio8a julio8a self-assigned this Mar 20, 2019
lib/sass/calcite-web/components/_dropdown.scss Outdated Show resolved Hide resolved
html[dir="rtl"] &.is-active, html[dir="rtl"] &:focus {
border-left: none;
border-right: 3px solid $blue;
html[dir="rtl"] &.is-active:before, html[dir="rtl"] &:focus:before, html[dir="rtl"] &:hover:before {
Copy link
Member

Choose a reason for hiding this comment

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

you don't need all these selectors. You're only declaring the left value on the :before pseudo element above, so that's the only one you need to correct in right to left. Just using

html[dir="rtl"] &:before {
  left: unset;
  right: 10px;
}

should be sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup, done.

border-right: 3px solid $blue;
html[dir="rtl"] &.is-active:before, html[dir="rtl"] &:focus:before, html[dir="rtl"] &:hover:before {
right: 10px;
padding-right: 0;
Copy link
Member

Choose a reason for hiding this comment

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

the :before doesn't have any padding, so I don't think you need this either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

padding-left: 0;
&:hover {
background: $white;
&:before {
Copy link
Member

Choose a reason for hiding this comment

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

honestly I wonder if it would be easier to not inherit from dropdown link so you don't have to unset all of these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed it

@@ -68,6 +89,7 @@
z-index: 1000;
display: none;
overflow: auto;
padding: 20px;
Copy link
Member

Choose a reason for hiding this comment

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

If possible we should probably use rem or baseline units here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to rem or baseline

cursor: auto;
border-bottom: 1px solid $lightest-gray;
margin: $baseline/3 $baseline/1.5 0 $baseline/1.5;
Copy link
Member

Choose a reason for hiding this comment

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

if we make the margin-bottom on this -1px it helps alleviate this weird UI moment when you hover on the first link under a title:

Screen Shot 2019-03-20 at 2 45 38 PM

Copy link
Member

Choose a reason for hiding this comment

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

here it is with -1px, the hover blends in so it feels more seamless:

Screen Shot 2019-03-20 at 2 47 01 PM

Copy link
Contributor

@macandcheese macandcheese Mar 21, 2019

Choose a reason for hiding this comment

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

Behind door number 3.... Making the first-child link have a transparent 1px border that on hover becomes #eaeaea to match the header-bottom. That way the border beneath the headline is maintained but there is no staggering:

dropdown with border

Couple other styling things:

Could we maybe tighten up the space between items by reducing y-padding 2-3 px ish? I think that would put it more in line with what's on DevExt now.

I think the active link and the header text are good candidates for 500 weight.

Cool with no animation / fade in or out for hover state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will work on these

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated spacing on title and links. Also added a fade in transition $transition

@@ -12,59 +12,79 @@
}
}

%dot {
Copy link
Member

Choose a reason for hiding this comment

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

you know, now that I'm looking at it, I think that these classes are global to sass, so we might want to name this something a little more specific as it's pretty likely somebody someday will have a sass class called dot. Maybe active-dot or dropdown-dot. IDK. Maybe @macandcheese will have a good idea on the name

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, either of those make sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

%dot is really only used here in one place, it might be useful to define it in a utils file to re-use the style in other upcoming updates, like side nav, or filters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ya, that's what I was thinking. @paulcpederson, you good with this?
Also, any thoughts on the class name? is dot good?

Copy link
Member

Choose a reason for hiding this comment

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

let's do like active-link-dot or something more specific

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@macandcheese macandcheese left a comment

Choose a reason for hiding this comment

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

Looks good, few things.

}

@mixin dropdown-btn {
cursor: pointer;
position: relative;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this used anymore? If not, let's remove from here and the include at the end of the file.

border-right: 3px solid $blue;
html[dir="rtl"] &:before {
left: unset;
right: .6rem;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could these be included in %dot?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -12,59 +12,79 @@
}
}

%dot {
Copy link
Contributor

Choose a reason for hiding this comment

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

%dot is really only used here in one place, it might be useful to define it in a utils file to re-use the style in other upcoming updates, like side nav, or filters.

@macandcheese
Copy link
Contributor

Last few style things... Could we lose a little bit of the heading top margin? It also seems like we could use a border on the dropdown to keep it from washing into the items behind it.

Current / suggested:

Slice

@macandcheese
Copy link
Contributor

macandcheese commented Mar 21, 2019

Is this how we want to handle multi-line options? Or center vertically within the element?

Screen Shot 2019-03-21 at 2 41 56 PM

I also can't seem to get the dropdowns to trigger in IE 11., maybe that's something on my end?

@paulcpederson
Copy link
Member

paulcpederson commented Mar 21, 2019

Is this how we want to handle multi-line options? Or center vertically within the element?

I think aligned with top line is good. Centered in element falls between the two lines of text and looks less intentional, IMO

@@ -8,66 +8,50 @@
position: relative;
display: inline-block;
&.is-active .dropdown-menu {
display: block;
opacity: 1;
Copy link
Member

Choose a reason for hiding this comment

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

So you generally can't use opacity alone to do UI's like this. The reason being I can't click anything behind the dropdown, even when it's closed. Also, you can tab into the hidden menu and focus on the links that are invisible.

If we want to do an animation, I would suggest using visibility: hidden and opacity together. There is a specific way you can combine them to get the animation and still have normal hiding. We do it in modals:

https://github.com/Esri/calcite-web/blob/master/lib/sass/calcite-web/patterns/_modal.scss#L21-L36

If we go that direction, a small transition down during the fade in would help relate the menu with the dropdown via the animation

Julio Ochoa and others added 5 commits March 22, 2019 09:27
- Added gray dots on hover
- active state (click) hets blue dot
- for some reason position was off, added top: 1 rem
@macandcheese
Copy link
Contributor

Closing, will re-open fresh PR.

@julio8a julio8a deleted the components/dropdown branch April 24, 2019 15:41
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