Skip to content

Commit

Permalink
Add link to subscriptions page
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavphadke1 committed Apr 14, 2024
1 parent 52b628e commit 2bc4f6f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 26 deletions.
39 changes: 22 additions & 17 deletions components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { merge } from 'lodash';
import Head from 'next/head';
import Link from 'next/link';
import { useRouter } from 'next/router';
import { NextRouter, useRouter } from 'next/router';
import React, {
ReactElement,
useCallback,
Expand Down Expand Up @@ -58,21 +58,20 @@ type HeaderProps = {
};

type DropdownMenuWrapperProps = {
splashPage?: boolean;
userInfo: UserInfo | null;
onSignOut: () => void;
onSignIn: (token: string) => void;
};

export const DropdownMenuWrapper = ({
splashPage = false,
userInfo,
onSignOut,
onSignIn,
}: DropdownMenuWrapperProps): ReactElement => {
const [showModal, setShowModal] = useState(false);
const [showMenuDropdown, setShowMenuDropdown] = useState(false);
const dropdownRef = useRef(null);
const router = useRouter();

useEffect(() => {
const handleCloseDropdown = (event: Event): void => {
Expand All @@ -96,23 +95,29 @@ export const DropdownMenuWrapper = ({
setShowMenuDropdown(!showMenuDropdown);
};

// Commented out until subscription page is finalized
// const subscriptionPage = (): void => {
// router.push('/subscriptions');
// };

const DropDownMenu = (): ReactElement => {
return (
<div className="user-menu">
<div
ref={dropdownRef}
className={
splashPage ? 'user-menu__splash-page' : 'user-menu__icon-wrapper'
}
onClick={toggleMenuDropdown}
>
{splashPage && <>Logged In</>}
<IconUser className="user-menu__icon" />
<div className={'user-menu__icon-wrapper'}>
<>
{userInfo && !macros.isMobile && (
<button
onClick={() => router.push('/subscriptions')}
className="user-menu__button"
>
Notifications
</button>
)}
{/* Still need to create FAQ page */}
{/* <button>FAQ</button> */}
</>
<div
className="user-menu__icon"
ref={dropdownRef}
onClick={toggleMenuDropdown}
>
<IconUser />
</div>
</div>

{showMenuDropdown && (
Expand Down
4 changes: 2 additions & 2 deletions components/ResultsPage/SemesterDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function SemesterDropdown({
className={'DropdownFilter__input'}
tabIndex={0}
type="text"
value={currentText}
/>
defaultValue={currentText}
></input>
<DropdownArrow
aria-label="Dropdown arrow"
className={`DropdownFilter__icon ${getDropdownStatus()}`}
Expand Down
1 change: 0 additions & 1 deletion pages/[campus]/[termId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export default function Home(): ReactElement {
</a>
<div className="signInButtonContainer">
<DropdownMenuWrapper
splashPage={true}
userInfo={userInfo}
onSignIn={onSignIn}
onSignOut={onSignOut}
Expand Down
22 changes: 16 additions & 6 deletions styles/pages/_Results.scss
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,28 @@ $SIDEBAR_WIDTH: 268px;
position: relative;
justify-content: flex-end;

&__icon-wrapper {
&__button {
display: flex;
padding: 13px 12px;
align-items: center;
cursor: pointer;
background: none;
border: none;
// text
color: Colors.$NEU9;

font-family: Lato;
font-size: 14px;
font-style: normal;
font-weight: 600;
line-height: 14px;
}

&__splash-page {
&__icon-wrapper {
display: inline-flex;
background: Colors.$White;
cursor: pointer;
align-items: center;
border-radius: 8px;
justify-content: center;
gap: 12px;
padding: 4px 12px;
}

&__icon {
Expand Down

0 comments on commit 2bc4f6f

Please sign in to comment.