Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
23 changes: 23 additions & 0 deletions resources/css/bem/navbar-mobile.less
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,28 @@

&--buttons {
flex: none;
display: flex;
align-items: center;
gap: 10px;
}
}

&__icon {
.link-plain();
.link-white();
flex: none;
position: relative;
.center-content();
width: 40px;
height: 40px;
margin: -5px;

&:hover {
color: @osu-colour-l1;
}

&.js-click-menu--active {
color: hsla(var(--hsl-c1), 50%);
}
}

Expand Down Expand Up @@ -61,6 +83,7 @@

&.js-click-menu--active {
transform: rotateX(0.5turn);
color: hsla(var(--hsl-c1), 50%);
}
}

Expand Down
10 changes: 7 additions & 3 deletions resources/js/components/notification-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ export default function NotificationIcon(props: Props) {
mobile: props.type === 'mobile',
};

const showCount = props.type !== 'mobile' || (props.ready && props.count > 0);

return (
<span className={classWithModifiers('notification-icon', modifiers)}>
<i className={props.iconClassName} />
<span className='notification-icon__count'>
{props.ready ? formatNumber(props.count) : '...'}
</span>
{showCount && (
<span className='notification-icon__count'>
{props.ready ? formatNumber(props.count) : '...'}
</span>
)}
</span>
);
}
7 changes: 5 additions & 2 deletions resources/js/core-legacy/nav2.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ export default class Nav2


autoMobileNav: (e, {previousTree, target, tree}) =>
wasShowingMobileNav = previousTree.indexOf('mobile-menu') != -1
@showingMobileNav = tree.indexOf('mobile-menu') != -1

if target == 'mobile-menu'
@clickMenu.show('mobile-nav')
Timeout.set 0, => $(@clickMenu.menu('mobile-menu')).finish().slideDown(150)

@showingMobileNav = tree.indexOf('mobile-menu') != -1
if @showingMobileNav && !wasShowingMobileNav
Timeout.set 0, => $(@clickMenu.menu('mobile-menu')).finish().slideDown(150)

if @showingMobileNav
document.body.classList.add('js-nav2--active')
Expand Down
7 changes: 7 additions & 0 deletions resources/js/core/click-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ export default class ClickMenu {
}
}

if (
(this.current === 'mobile-chat-notification' || this.current === 'mobile-notification')
&& !tree.includes('mobile-menu')
) {
tree.push('mobile-menu');
}

return tree;
};

Expand Down
60 changes: 30 additions & 30 deletions resources/views/layout/_header_mobile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,36 @@
</div>

<div class="navbar-mobile__header-section navbar-mobile__header-section--buttons">
@if (isset($user))
<a
class="navbar-mobile__icon js-click-menu js-react"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just use the existing block class.
I don't see the point of copying a block's styles into the element level of another block when everything in it is pretty much the same other than the name.

data-click-menu-target="mobile-chat-notification"
data-react="chat-icon"
data-turbo-permanent
data-type="mobile"
id="notification-widget-chat-icon-mobile"
href="{{ route('chat.index') }}"
>
<span class="notification-icon notification-icon--mobile">
<i class="fas fa-comment-alt"></i>
</span>
</a>

<a
class="navbar-mobile__icon js-click-menu js-react"
data-click-menu-target="mobile-notification"
data-react="main-notification-icon"
data-turbo-permanent
data-type="mobile"
id="notification-widget-icon-mobile"
href="{{ route('notifications.index') }}"
>
<span class="notification-icon notification-icon--mobile">
<i class="fas fa-bell"></i>
</span>
</a>
@endif

<button
type="button"
class="navbar-mobile__toggle js-click-menu"
Expand Down Expand Up @@ -87,36 +117,6 @@ class="mobile-menu-tab mobile-menu-tab--user js-user-link"
<button class="mobile-menu-tab js-click-menu" data-click-menu-target="mobile-search">
<span class="fas fa-search"></span>
</button>

<a
class="mobile-menu-tab js-click-menu js-react"
data-click-menu-target="mobile-chat-notification"
data-react="chat-icon"
data-turbo-permanent
data-type='mobile'
id="notification-widget-chat-icon-mobile"
href="{{ route('chat.index') }}"
>
<span class="notification-icon notification-icon--mobile">
<i class="fas fa-comment-alt"></i>
<span class="notification-icon__count">...</span>
</span>
</a>

<a
class="mobile-menu-tab js-click-menu js-react"
data-click-menu-target="mobile-notification"
data-react="main-notification-icon"
data-turbo-permanent
data-type='mobile'
id="notification-widget-icon-mobile"
href="{{ route('notifications.index') }}"
>
<span class="notification-icon notification-icon--mobile">
<i class="fas fa-inbox"></i>
<span class="notification-icon__count">...</span>
</span>
</a>
@endif
</div>

Expand Down