From b8a7a8e376265dc5b47031647440ab77b34e497e Mon Sep 17 00:00:00 2001 From: Eunju Huss Date: Thu, 6 Feb 2025 14:49:08 +0100 Subject: [PATCH 01/23] Add submenu --- src/components/Common/HeaderNav.tsx | 60 ++++++++++++++++++++++++++++- src/styles/_Header.scss | 10 +++++ 2 files changed, 68 insertions(+), 2 deletions(-) diff --git a/src/components/Common/HeaderNav.tsx b/src/components/Common/HeaderNav.tsx index 88ee72ae7..f95b0757d 100644 --- a/src/components/Common/HeaderNav.tsx +++ b/src/components/Common/HeaderNav.tsx @@ -10,6 +10,7 @@ import { NavLink } from "react-router-dom"; // export for use in tests export const activeClassName = "active"; +type ButtonKey = "identity" | "security" | "account"; export interface HeaderNavProps { handleLogout: () => void; @@ -67,8 +68,20 @@ function useCloseMenuClickOutside(ref: React.RefObject, handler: () export function HeaderNav(props: HeaderNavProps): JSX.Element { const [openMenu, setOpenMenu] = useState(false); + const [isOpen, setIsOpen] = useState<{ [key in ButtonKey]: boolean }>({ + identity: false, + security: false, + account: false, + }); const wrapperRef = useRef(null); + const toggleOpen = (button: ButtonKey) => { + setIsOpen((prevState) => ({ + ...prevState, + [button]: !prevState[button], + })); + }; + useCloseMenuClickOutside(wrapperRef, () => setOpenMenu(false)); return ( diff --git a/src/styles/_Header.scss b/src/styles/_Header.scss index 558761c49..c23d9b850 100644 --- a/src/styles/_Header.scss +++ b/src/styles/_Header.scss @@ -32,9 +32,8 @@ header { li { padding-top: 5px; padding-bottom: 5px; - } - li:last-child { - margin-bottom: 1.5rem; + font-family: $akkurat; + color: $txt-gray; } } .panel-close { @@ -91,6 +90,8 @@ header { .flex-between { padding-left: 10px; + margin-top: 3px; + margin-bottom: 3px; button { background-color: transparent; @@ -100,7 +101,7 @@ header { .flex-between:hover { background-color: $body-gray; - border-radius: 15px; + border-radius: 25px; } } @@ -121,6 +122,7 @@ header { border-radius: 10px; padding: 20px; right: 20px; + max-width: 20rem; .btn-link svg { padding-right: 5px; @@ -134,12 +136,16 @@ header { height: 2.7rem; justify-content: left; line-height: 1.2; - // width: 100%; &:nth-child(4) { border-bottom: 1px solid $border-gray; } } + .logout-button-wrapper { + margin-top: 1rem; + padding-top: 1rem; + border-top: 1px solid $border-gray; + } } } } From 92265fc4ccc9863b7cf2b4ab6f93e65d56726ad3 Mon Sep 17 00:00:00 2001 From: Eunju Huss Date: Wed, 12 Feb 2025 14:53:39 +0100 Subject: [PATCH 07/23] Adjust padding, margin in header --- src/styles/_Header.scss | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/styles/_Header.scss b/src/styles/_Header.scss index c23d9b850..6c69dce1c 100644 --- a/src/styles/_Header.scss +++ b/src/styles/_Header.scss @@ -30,8 +30,9 @@ header { margin-left: 1.3rem; li { - padding-top: 5px; - padding-bottom: 5px; + font-size: 0.9rem; + padding-top: 3px; + padding-bottom: 3px; font-family: $akkurat; color: $txt-gray; } @@ -101,12 +102,13 @@ header { .flex-between:hover { background-color: $body-gray; - border-radius: 25px; + border-radius: 20px; } } .btn-close { align-self: flex-end; + margin-bottom: 1rem; } &.active { @@ -142,8 +144,8 @@ header { } } .logout-button-wrapper { - margin-top: 1rem; - padding-top: 1rem; + margin: 0.5rem 0 0 10px; + padding-top: 0.5rem; border-top: 1px solid $border-gray; } } From fd90ab30dd0fd32b6307a19513034f9d29d87a43 Mon Sep 17 00:00:00 2001 From: Eunju Huss Date: Wed, 12 Feb 2025 15:34:16 +0100 Subject: [PATCH 08/23] Set links for the submenus --- src/components/Common/HeaderNav.tsx | 48 +++++++++++++++++++++-------- src/styles/_Header.scss | 21 +++++++++---- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/src/components/Common/HeaderNav.tsx b/src/components/Common/HeaderNav.tsx index c969c7008..b3dbd75b3 100644 --- a/src/components/Common/HeaderNav.tsx +++ b/src/components/Common/HeaderNav.tsx @@ -110,7 +110,9 @@ export function HeaderNav(props: HeaderNavProps): JSX.Element {
  • - + + +
@@ -134,10 +136,14 @@ export function HeaderNav(props: HeaderNavProps): JSX.Element {
  • - + + +
  • - + + +
@@ -161,10 +167,14 @@ export function HeaderNav(props: HeaderNavProps): JSX.Element {
  • - + + +
  • - + + +
@@ -187,25 +197,39 @@ export function HeaderNav(props: HeaderNavProps): JSX.Element {
  • - + + +
  • - + + +
  • - + + +
  • - + + +
  • - + + +
  • - + + +
  • - + + +
diff --git a/src/styles/_Header.scss b/src/styles/_Header.scss index 6c69dce1c..0c258a25b 100644 --- a/src/styles/_Header.scss +++ b/src/styles/_Header.scss @@ -29,13 +29,22 @@ header { transition: max-height 0.2s ease; margin-left: 1.3rem; - li { - font-size: 0.9rem; - padding-top: 3px; - padding-bottom: 3px; - font-family: $akkurat; - color: $txt-gray; + ul { + a { + font-size: 0.9rem; + padding-top: 3px; + padding-bottom: 3px; + color: $txt-gray; + } } + + // li { + // font-size: 0.9rem; + // padding-top: 3px; + // padding-bottom: 3px; + // font-family: $akkurat; + // color: $txt-gray; + // } } .panel-close { max-height: 0; From 46cbbc2571cdf61358a0d8935bfb901c399808fe Mon Sep 17 00:00:00 2001 From: Eunju Huss Date: Wed, 12 Feb 2025 15:49:24 +0100 Subject: [PATCH 09/23] Add an onclick function to close the nav menu when the user selects an option --- src/components/Common/HeaderNav.tsx | 29 +++++++++++-------- .../Dashboard/PersonalDataParent.tsx | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/components/Common/HeaderNav.tsx b/src/components/Common/HeaderNav.tsx index b3dbd75b3..bc06e5597 100644 --- a/src/components/Common/HeaderNav.tsx +++ b/src/components/Common/HeaderNav.tsx @@ -7,6 +7,7 @@ import { useAppSelector } from "eduid-hooks"; import React, { useEffect, useRef, useState } from "react"; import { FormattedMessage } from "react-intl"; import { NavLink } from "react-router-dom"; +import { NavHashLink } from "react-router-hash-link"; // export for use in tests export const activeClassName = "active"; @@ -136,14 +137,18 @@ export function HeaderNav(props: HeaderNavProps): JSX.Element {
  • - + setOpenMenu(false)} to={IDENTITY_PATH}>
  • - + setOpenMenu(false)} + to={`${IDENTITY_PATH}#personal-data`} + aria-label="go to manage your security key section" + > - +
@@ -167,12 +172,12 @@ export function HeaderNav(props: HeaderNavProps): JSX.Element {
  • - + setOpenMenu(false)} to={SECURITY_PATH}>
  • - + setOpenMenu(false)} to={SECURITY_PATH}>
  • @@ -197,37 +202,37 @@ export function HeaderNav(props: HeaderNavProps): JSX.Element {
    • - + setOpenMenu(false)} to={ACCOUNT_PATH}>
    • - + setOpenMenu(false)} to={ACCOUNT_PATH}>
    • - + setOpenMenu(false)} to={ACCOUNT_PATH}>
    • - + setOpenMenu(false)} to={ACCOUNT_PATH}>
    • - + setOpenMenu(false)} to={ACCOUNT_PATH}>
    • - + setOpenMenu(false)} to={ACCOUNT_PATH}>
    • - + setOpenMenu(false)} to={ACCOUNT_PATH}>
    • diff --git a/src/components/Dashboard/PersonalDataParent.tsx b/src/components/Dashboard/PersonalDataParent.tsx index 00940e3d3..35deeed8a 100644 --- a/src/components/Dashboard/PersonalDataParent.tsx +++ b/src/components/Dashboard/PersonalDataParent.tsx @@ -114,7 +114,7 @@ function PersonalDataParent() { }; return ( -
      +

      From 5bac6a9b94cb77d06df34c8d30d786f51d8fdd38 Mon Sep 17 00:00:00 2001 From: Eunju Huss Date: Thu, 13 Feb 2025 11:04:21 +0100 Subject: [PATCH 10/23] Add an ID to articles to link it from the submenu click --- src/components/Common/HeaderNav.tsx | 52 +++++++++---------- .../Common/MultiFactorAuthentication.tsx | 2 +- src/components/Dashboard/AccountId.tsx | 2 +- src/components/Dashboard/AccountLinking.tsx | 2 +- .../Dashboard/ChangePasswordDisplay.tsx | 2 +- src/components/Dashboard/DeleteAccount.tsx | 2 +- src/components/Dashboard/Emails.tsx | 2 +- src/components/Dashboard/Identity.tsx | 2 +- src/components/Dashboard/Ladok.tsx | 2 +- src/components/Dashboard/Language.tsx | 2 +- src/components/Dashboard/Recommendations.tsx | 2 +- src/styles/_Header.scss | 4 +- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/components/Common/HeaderNav.tsx b/src/components/Common/HeaderNav.tsx index bc06e5597..f698aeb66 100644 --- a/src/components/Common/HeaderNav.tsx +++ b/src/components/Common/HeaderNav.tsx @@ -108,12 +108,12 @@ export function HeaderNav(props: HeaderNavProps): JSX.Element { )}

      -
      +
      • - + setOpenMenu(false)} to={`${START_PATH}#status-overview`} end> - +
      @@ -134,12 +134,12 @@ export function HeaderNav(props: HeaderNavProps): JSX.Element { )}
      -
      +
      • - setOpenMenu(false)} to={IDENTITY_PATH}> + setOpenMenu(false)} to={`${IDENTITY_PATH}#verify-identity`}> - +
      -
      +
      • - setOpenMenu(false)} to={SECURITY_PATH}> + setOpenMenu(false)} to={`${SECURITY_PATH}#add-two-factor`}> - +
      • - setOpenMenu(false)} to={SECURITY_PATH}> + setOpenMenu(false)} to={`${SECURITY_PATH}#manage-security-keys`}> - +
      @@ -199,42 +199,42 @@ export function HeaderNav(props: HeaderNavProps): JSX.Element { )}
      -
      +
      • - setOpenMenu(false)} to={ACCOUNT_PATH}> + setOpenMenu(false)} to={`${ACCOUNT_PATH}#unique-id`}> - +
      • - setOpenMenu(false)} to={ACCOUNT_PATH}> + setOpenMenu(false)} to={`${ACCOUNT_PATH}#add-email-addresses`}> - +
      • - setOpenMenu(false)} to={ACCOUNT_PATH}> + setOpenMenu(false)} to={`${ACCOUNT_PATH}#language`}> - +
      • - setOpenMenu(false)} to={ACCOUNT_PATH}> + setOpenMenu(false)} to={`${ACCOUNT_PATH}#change-password`}> - +
      • - setOpenMenu(false)} to={ACCOUNT_PATH}> + setOpenMenu(false)} to={`${ACCOUNT_PATH}#orcid`}> - +
      • - setOpenMenu(false)} to={ACCOUNT_PATH}> + setOpenMenu(false)} to={`${ACCOUNT_PATH}#ladok`}> - +
      • - setOpenMenu(false)} to={ACCOUNT_PATH}> + setOpenMenu(false)} to={`${ACCOUNT_PATH}#delete-account`}> - +
      diff --git a/src/components/Common/MultiFactorAuthentication.tsx b/src/components/Common/MultiFactorAuthentication.tsx index 3df3a6c70..66af027ab 100644 --- a/src/components/Common/MultiFactorAuthentication.tsx +++ b/src/components/Common/MultiFactorAuthentication.tsx @@ -246,7 +246,7 @@ export function MultiFactorAuthentication(): React.ReactElement | null { if (!isPlatformAuthLoaded) return null; return ( <> -
      +

      diff --git a/src/components/Dashboard/AccountId.tsx b/src/components/Dashboard/AccountId.tsx index 52b3f1744..c9da200ba 100644 --- a/src/components/Dashboard/AccountId.tsx +++ b/src/components/Dashboard/AccountId.tsx @@ -24,7 +24,7 @@ export function AccountId(): JSX.Element { export function AccountIdDisplay(): JSX.Element { return ( -
      +

      diff --git a/src/components/Dashboard/AccountLinking.tsx b/src/components/Dashboard/AccountLinking.tsx index b4361381c..f5186a1f5 100644 --- a/src/components/Dashboard/AccountLinking.tsx +++ b/src/components/Dashboard/AccountLinking.tsx @@ -3,7 +3,7 @@ import { FormattedMessage } from "react-intl"; export function AccountLinking() { return ( -
      +

      diff --git a/src/components/Dashboard/ChangePasswordDisplay.tsx b/src/components/Dashboard/ChangePasswordDisplay.tsx index c7c54a15b..87c0ad843 100644 --- a/src/components/Dashboard/ChangePasswordDisplay.tsx +++ b/src/components/Dashboard/ChangePasswordDisplay.tsx @@ -16,7 +16,7 @@ function ChangePasswordDisplay() { } } return ( -
      +

      diff --git a/src/components/Dashboard/DeleteAccount.tsx b/src/components/Dashboard/DeleteAccount.tsx index ca0da1c5d..20ab39c08 100644 --- a/src/components/Dashboard/DeleteAccount.tsx +++ b/src/components/Dashboard/DeleteAccount.tsx @@ -18,7 +18,7 @@ export default function DeleteAccount(): JSX.Element | null { } return ( -
      +

      diff --git a/src/components/Dashboard/Emails.tsx b/src/components/Dashboard/Emails.tsx index 857c36377..16cf72504 100644 --- a/src/components/Dashboard/Emails.tsx +++ b/src/components/Dashboard/Emails.tsx @@ -109,7 +109,7 @@ function Emails() { } return ( -
      +

      diff --git a/src/components/Dashboard/Identity.tsx b/src/components/Dashboard/Identity.tsx index 80d7534d9..7f6ce3efa 100644 --- a/src/components/Dashboard/Identity.tsx +++ b/src/components/Dashboard/Identity.tsx @@ -108,7 +108,7 @@ function IdentityContent(): JSX.Element {
      -
      +
      {identities?.is_verified ? (

      diff --git a/src/components/Dashboard/Ladok.tsx b/src/components/Dashboard/Ladok.tsx index 4f0800850..fa43047af 100644 --- a/src/components/Dashboard/Ladok.tsx +++ b/src/components/Dashboard/Ladok.tsx @@ -29,7 +29,7 @@ const LadokContainer = (): JSX.Element => { useEffect(() => setSwitchChecked(isLinked), [isLinked]); return ( -
      +

      diff --git a/src/components/Dashboard/Language.tsx b/src/components/Dashboard/Language.tsx index e662b7517..9ed78e116 100644 --- a/src/components/Dashboard/Language.tsx +++ b/src/components/Dashboard/Language.tsx @@ -36,7 +36,7 @@ export function LanguagePreference() { } return ( -
      +

      diff --git a/src/components/Dashboard/Recommendations.tsx b/src/components/Dashboard/Recommendations.tsx index ce2d5878a..cce23e7a6 100644 --- a/src/components/Dashboard/Recommendations.tsx +++ b/src/components/Dashboard/Recommendations.tsx @@ -197,7 +197,7 @@ export function Recommendations(): JSX.Element | null { } return ( -
      +

      diff --git a/src/styles/_Header.scss b/src/styles/_Header.scss index 0c258a25b..0c44c89bd 100644 --- a/src/styles/_Header.scss +++ b/src/styles/_Header.scss @@ -23,7 +23,7 @@ header { .header-nav { // sub menu - .panel-collapse { + .submenu-collapse { max-height: 500px; overflow: hidden; transition: max-height 0.2s ease; @@ -46,7 +46,7 @@ header { // color: $txt-gray; // } } - .panel-close { + .submenu-close { max-height: 0; } From 3e5f2feca7bdaefb031f9e649fcc0f8ac597c2d7 Mon Sep 17 00:00:00 2001 From: Eunju Huss Date: Thu, 13 Feb 2025 11:23:56 +0100 Subject: [PATCH 11/23] Add title for close button --- src/components/Common/HeaderNav.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/Common/HeaderNav.tsx b/src/components/Common/HeaderNav.tsx index f698aeb66..1292efa19 100644 --- a/src/components/Common/HeaderNav.tsx +++ b/src/components/Common/HeaderNav.tsx @@ -5,7 +5,7 @@ import EduIDButton from "components/Common/EduIDButton"; import { ACCOUNT_PATH, IDENTITY_PATH, SECURITY_PATH, START_PATH } from "components/IndexMain"; import { useAppSelector } from "eduid-hooks"; import React, { useEffect, useRef, useState } from "react"; -import { FormattedMessage } from "react-intl"; +import { FormattedMessage, useIntl } from "react-intl"; import { NavLink } from "react-router-dom"; import { NavHashLink } from "react-router-hash-link"; @@ -76,6 +76,7 @@ export function HeaderNav(props: HeaderNavProps): JSX.Element { account: false, }); const wrapperRef = useRef(null); + const intl = useIntl(); const toggleOpen = (button: ButtonKey) => { setIsOpen((prevState) => ({ @@ -89,7 +90,15 @@ export function HeaderNav(props: HeaderNavProps): JSX.Element {