-
-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create dashboard header component
- Loading branch information
Showing
7 changed files
with
126 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
'use client'; | ||
|
||
import { OrganizationSwitcher, UserButton } from '@clerk/nextjs'; | ||
import Link from 'next/link'; | ||
import { useLocale, useTranslations } from 'next-intl'; | ||
|
||
import { ActiveLink } from '@/components/ActiveLink'; | ||
import LocaleSwitcher from '@/components/LocaleSwitcher'; | ||
import { ToggleMenuButton } from '@/components/ToggleMenuButton'; | ||
import { Logo } from '@/templates/Logo'; | ||
import { getI18nPath } from '@/utils/Helpers'; | ||
|
||
const DashboardHeader = () => { | ||
const t = useTranslations('DashboardLayout'); | ||
const locale = useLocale(); | ||
|
||
return ( | ||
<> | ||
<div className="flex items-center"> | ||
<Link href="/dashboard" className="max-sm:hidden"> | ||
<Logo /> | ||
</Link> | ||
|
||
<svg | ||
className="ml-1 size-8 stroke-muted-foreground max-sm:hidden" | ||
xmlns="http://www.w3.org/2000/svg" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
> | ||
<path stroke="none" d="M0 0h24v24H0z" /> | ||
<path d="M17 5 7 19" /> | ||
</svg> | ||
|
||
<OrganizationSwitcher | ||
organizationProfileMode="navigation" | ||
organizationProfileUrl={getI18nPath( | ||
'/dashboard/organization-profile', | ||
locale, | ||
)} | ||
afterCreateOrganizationUrl="/dashboard" | ||
hidePersonal | ||
skipInvitationScreen | ||
appearance={{ | ||
elements: { | ||
organizationSwitcherTrigger: 'max-w-52', | ||
}, | ||
}} | ||
/> | ||
|
||
<nav className="ml-3 max-lg:hidden"> | ||
<ul className="flex flex-row items-center gap-x-3 text-lg font-medium [&_a:hover]:opacity-100 [&_a]:opacity-75"> | ||
<li> | ||
<ActiveLink href="/dashboard">{t('home')}</ActiveLink> | ||
</li> | ||
|
||
<li> | ||
<ActiveLink href="/dashboard/organization-profile/organization-members"> | ||
{t('members')} | ||
</ActiveLink> | ||
</li> | ||
|
||
<li> | ||
<ActiveLink href="/dashboard/organization-profile"> | ||
{t('settings')} | ||
</ActiveLink> | ||
</li> | ||
</ul> | ||
</nav> | ||
</div> | ||
|
||
<div className=""> | ||
<ul className="flex items-center gap-x-1 [&_li:not(:last-child):hover]:opacity-100 [&_li:not(:last-child)]:opacity-60"> | ||
<li> | ||
<div className="lg:hidden"> | ||
<ToggleMenuButton onClick={() => {}} /> | ||
</div> | ||
</li> | ||
|
||
<li> | ||
<LocaleSwitcher /> | ||
</li> | ||
|
||
<li> | ||
<UserButton | ||
userProfileMode="navigation" | ||
userProfileUrl="/dashboard/user-profile" | ||
afterSignOutUrl="/" | ||
appearance={{ | ||
elements: { | ||
rootBox: 'px-2 py-1.5', | ||
}, | ||
}} | ||
/> | ||
</li> | ||
</ul> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export { DashboardHeader }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters