Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(Header): Make dropdown to pop up correctly on small screens

haitao(lj)776b2235d36e
diff --git a/ui/src/components/Header/components/NavItems/index.tsx b/ui/src/components/Header/components/NavItems/index.tsx
index 9112aecc..4b377ad7 100644
--- a/ui/src/components/Header/components/NavItems/index.tsx
+++ b/ui/src/components/Header/components/NavItems/index.tsx
@@ -16,23 +16,25 @@ const Index: FC<Props> = ({ redDot, userInfo, logOut }) => {
const { t } = useTranslation();
return (
<>
- <Nav.Link
- as={NavLink}
- to="/users/notifications/inbox"
- className="icon-link d-flex align-items-center justify-content-center p-0 me-3 position-relative">
- <Icon name="bell-fill" className="fs-4" />
- {(redDot?.inbox || 0) > 0 && <div className="unread-dot bg-danger" />}
- </Nav.Link>
+ <Nav className="flex-row">
+ <Nav.Link
+ as={NavLink}
+ to="/users/notifications/inbox"
+ className="icon-link d-flex align-items-center justify-content-center p-0 me-3 position-relative">
+ <Icon name="bell-fill" className="fs-4" />
+ {(redDot?.inbox || 0) > 0 && <div className="unread-dot bg-danger" />}
+ </Nav.Link>
- <Nav.Link
- as={Link}
- to="/users/notifications/achievement"
- className="icon-link d-flex align-items-center justify-content-center p-0 me-3 position-relative">
- <Icon name="trophy-fill" className="fs-4" />
- {(redDot?.achievement || 0) > 0 && (
- <div className="unread-dot bg-danger" />
- )}
- </Nav.Link>
+ <Nav.Link
+ as={Link}
+ to="/users/notifications/achievement"
+ className="icon-link d-flex align-items-center justify-content-center p-0 me-3 position-relative">
+ <Icon name="trophy-fill" className="fs-4" />
+ {(redDot?.achievement || 0) > 0 && (
+ <div className="unread-dot bg-danger" />
+ )}
+ </Nav.Link>
+ </Nav>
<Dropdown align="end">
<Dropdown.Toggle
diff --git a/ui/src/components/Header/index.tsx b/ui/src/components/Header/index.tsx
index 418d7ebc..c5daf7db 100644
--- a/ui/src/components/Header/index.tsx
+++ b/ui/src/components/Header/index.tsx
@@ -118,13 +118,7 @@ const Header: FC = () => {
{/* mobile nav */}
<div className="d-flex lg-none align-items-center flex-lg-nowrap">
{user?.username ? (
- <Nav className="flex-row">
- <NavItems
- redDot={redDot}
- userInfo={user}
- logOut={handleLogout}
- />
- </Nav>
+ <NavItems redDot={redDot} userInfo={user} logOut={handleLogout} />
) : (
<>
<Button variant="link" className="me-2" href="/users/login">