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

User dropdown menu updates #1899

Merged
merged 4 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/public/scss/top-app-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ header.site-header.new-design {
display: block;
font-size: 14px;
line-height: 21px;
border-left: 1px solid $home-page-border-grey;
padding-left: 15px;

@include media-breakpoint-down(md) {
display: none;
Expand Down
56 changes: 56 additions & 0 deletions frontend/public/scss/user-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,59 @@
border-color: transparent;
background-color: inherit;
}

// New design
.top-user-menu .dropdown-menu {
margin-top: 17px;
padding: 0;
display: none;

.dropdown-item {
display: block;
padding: 15px 20px;
}
&.show {
display: block;
box-shadow: none;
border-radius: 0 0 3px 3px;
}
}
.top-user-menu.dropdown {
Copy link
Contributor

Choose a reason for hiding this comment

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

This line and .dropdown-menu could probably wrap inside a .top-user-menu {} block for readability.

@include media-breakpoint-down(sm) {
display: none;
}
.dropdown-toggle.user-menu-button {
&.show {
&:after {
border-color: $primary;
transform: rotate(45deg);
margin-top: 1px;
}
}
}
.dropdown-toggle {
max-width: 40ch;
padding: 0;
font-weight: 600;
text-overflow: ellipsis;
position: relative;
display: flex;
align-items: center;
padding-right: 15px;

&:after {
border: 1px;
border-top: 1px solid black;
border-left: 1px solid black;
width: 8px;
height: 8px;
transform: rotate(225deg);
margin-left: 10px;
transition: 0.5s;
}

&:hover {
cursor: pointer;
}
}
}
9 changes: 8 additions & 1 deletion frontend/public/src/components/UserMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import MixedLink from "./MixedLink"
import { routes } from "../lib/urls"

import type { User } from "../flow/authTypes"
import { checkFeatureFlag } from "../lib/util"

type Props = {
/* This is here for future use when we have custom profile avatars */
Expand All @@ -15,6 +16,9 @@ type Props = {
const desktopMenuContainerProps = {
className: "user-menu dropdown"
}
const newDesktopMenuContainerProps = {
className: "top-user-menu dropdown"
}

const desktopUListProps = {
className: "dropdown-menu dropdown-menu-end"
Expand All @@ -38,13 +42,16 @@ const UserMenu = ({ currentUser, useScreenOverlay }: Props) => {
/* eslint-disable prefer-const */
let menuChildProps: MenuChildProps
let dropdownIdentifier = "dropdownMenuButton"
const showNewDesign = checkFeatureFlag("mitxonline-new-header")
menuChildProps = useScreenOverlay
? {
li: overlayListItemProps,
dropdownIdentifier: dropdownIdentifier.concat("Mobile")
}
: {
container: desktopMenuContainerProps,
container: showNewDesign
? newDesktopMenuContainerProps
: desktopMenuContainerProps,
ul: desktopUListProps,
li: desktopListItemProps,
dropdownIdentifier: dropdownIdentifier.concat("Desktop")
Expand Down