-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add language selector and update getBySlug hook
- Loading branch information
1 parent
c5be944
commit f3b5940
Showing
16 changed files
with
600 additions
and
15 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
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,187 @@ | ||
"use client"; | ||
|
||
import * as React from "react"; | ||
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"; | ||
import { Check, ChevronRight, Circle } from "lucide-react"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
|
||
const DropdownMenu = DropdownMenuPrimitive.Root; | ||
|
||
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; | ||
|
||
const DropdownMenuGroup = DropdownMenuPrimitive.Group; | ||
|
||
const DropdownMenuPortal = DropdownMenuPrimitive.Portal; | ||
|
||
const DropdownMenuSub = DropdownMenuPrimitive.Sub; | ||
|
||
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup; | ||
|
||
const DropdownMenuSubTrigger = React.forwardRef< | ||
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>, | ||
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & { | ||
inset?: boolean; | ||
} | ||
>(({ className, inset, children, ...props }, ref) => ( | ||
<DropdownMenuPrimitive.SubTrigger | ||
ref={ref} | ||
className={cn( | ||
"focus:bg-accent data-[state=open]:bg-accent flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none", | ||
inset && "pl-8", | ||
className, | ||
)} | ||
{...props} | ||
> | ||
{children} | ||
<ChevronRight className="ml-auto h-4 w-4" /> | ||
</DropdownMenuPrimitive.SubTrigger> | ||
)); | ||
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName; | ||
|
||
const DropdownMenuSubContent = React.forwardRef< | ||
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>, | ||
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent> | ||
>(({ className, ...props }, ref) => ( | ||
<DropdownMenuPrimitive.SubContent | ||
ref={ref} | ||
className={cn( | ||
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg", | ||
className, | ||
)} | ||
{...props} | ||
/> | ||
)); | ||
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName; | ||
|
||
const DropdownMenuContent = React.forwardRef< | ||
React.ElementRef<typeof DropdownMenuPrimitive.Content>, | ||
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> | ||
>(({ className, sideOffset = 4, ...props }, ref) => ( | ||
<DropdownMenuPrimitive.Portal> | ||
<DropdownMenuPrimitive.Content | ||
ref={ref} | ||
sideOffset={sideOffset} | ||
className={cn( | ||
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md", | ||
className, | ||
)} | ||
{...props} | ||
/> | ||
</DropdownMenuPrimitive.Portal> | ||
)); | ||
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName; | ||
|
||
const DropdownMenuItem = React.forwardRef< | ||
React.ElementRef<typeof DropdownMenuPrimitive.Item>, | ||
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { | ||
inset?: boolean; | ||
} | ||
>(({ className, inset, ...props }, ref) => ( | ||
<DropdownMenuPrimitive.Item | ||
ref={ref} | ||
className={cn( | ||
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50", | ||
inset && "pl-8", | ||
className, | ||
)} | ||
{...props} | ||
/> | ||
)); | ||
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; | ||
|
||
const DropdownMenuCheckboxItem = React.forwardRef< | ||
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>, | ||
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem> | ||
>(({ className, children, checked, ...props }, ref) => ( | ||
<DropdownMenuPrimitive.CheckboxItem | ||
ref={ref} | ||
className={cn( | ||
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50", | ||
className, | ||
)} | ||
checked={checked} | ||
{...props} | ||
> | ||
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"> | ||
<DropdownMenuPrimitive.ItemIndicator> | ||
<Check className="h-4 w-4" /> | ||
</DropdownMenuPrimitive.ItemIndicator> | ||
</span> | ||
{children} | ||
</DropdownMenuPrimitive.CheckboxItem> | ||
)); | ||
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName; | ||
|
||
const DropdownMenuRadioItem = React.forwardRef< | ||
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>, | ||
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem> | ||
>(({ className, children, ...props }, ref) => ( | ||
<DropdownMenuPrimitive.RadioItem | ||
ref={ref} | ||
className={cn( | ||
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50", | ||
className, | ||
)} | ||
{...props} | ||
> | ||
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"> | ||
<DropdownMenuPrimitive.ItemIndicator> | ||
<Circle className="h-2 w-2 fill-current" /> | ||
</DropdownMenuPrimitive.ItemIndicator> | ||
</span> | ||
{children} | ||
</DropdownMenuPrimitive.RadioItem> | ||
)); | ||
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName; | ||
|
||
const DropdownMenuLabel = React.forwardRef< | ||
React.ElementRef<typeof DropdownMenuPrimitive.Label>, | ||
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & { | ||
inset?: boolean; | ||
} | ||
>(({ className, inset, ...props }, ref) => ( | ||
<DropdownMenuPrimitive.Label | ||
ref={ref} | ||
className={cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className)} | ||
{...props} | ||
/> | ||
)); | ||
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName; | ||
|
||
const DropdownMenuSeparator = React.forwardRef< | ||
React.ElementRef<typeof DropdownMenuPrimitive.Separator>, | ||
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator> | ||
>(({ className, ...props }, ref) => ( | ||
<DropdownMenuPrimitive.Separator | ||
ref={ref} | ||
className={cn("bg-muted -mx-1 my-1 h-px", className)} | ||
{...props} | ||
/> | ||
)); | ||
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName; | ||
|
||
const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => { | ||
return ( | ||
<span className={cn("ml-auto text-xs tracking-widest opacity-60", className)} {...props} /> | ||
); | ||
}; | ||
DropdownMenuShortcut.displayName = "DropdownMenuShortcut"; | ||
|
||
export { | ||
DropdownMenu, | ||
DropdownMenuTrigger, | ||
DropdownMenuContent, | ||
DropdownMenuItem, | ||
DropdownMenuCheckboxItem, | ||
DropdownMenuRadioItem, | ||
DropdownMenuLabel, | ||
DropdownMenuSeparator, | ||
DropdownMenuShortcut, | ||
DropdownMenuGroup, | ||
DropdownMenuPortal, | ||
DropdownMenuSub, | ||
DropdownMenuSubContent, | ||
DropdownMenuSubTrigger, | ||
DropdownMenuRadioGroup, | ||
}; |
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,120 @@ | ||
import * as React from "react"; | ||
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"; | ||
import { cva } from "class-variance-authority"; | ||
import { ChevronDown } from "lucide-react"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
|
||
const NavigationMenu = React.forwardRef< | ||
React.ElementRef<typeof NavigationMenuPrimitive.Root>, | ||
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root> | ||
>(({ className, children, ...props }, ref) => ( | ||
<NavigationMenuPrimitive.Root | ||
ref={ref} | ||
className={cn("relative z-10 flex flex-1", className)} | ||
{...props} | ||
> | ||
{children} | ||
{/* <NavigationMenuViewport /> */} | ||
</NavigationMenuPrimitive.Root> | ||
)); | ||
NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName; | ||
|
||
const NavigationMenuList = React.forwardRef< | ||
React.ElementRef<typeof NavigationMenuPrimitive.List>, | ||
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List> | ||
>(({ className, ...props }, ref) => ( | ||
<NavigationMenuPrimitive.List | ||
ref={ref} | ||
className={cn("group flex flex-1 list-none items-center justify-center space-x-1", className)} | ||
{...props} | ||
/> | ||
)); | ||
NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName; | ||
|
||
const NavigationMenuItem = NavigationMenuPrimitive.Item; | ||
|
||
const navigationMenuTriggerStyle = cva( | ||
"group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50", | ||
); | ||
|
||
const NavigationMenuTrigger = React.forwardRef< | ||
React.ElementRef<typeof NavigationMenuPrimitive.Trigger>, | ||
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger> | ||
>(({ className, children, ...props }, ref) => ( | ||
<NavigationMenuPrimitive.Trigger | ||
ref={ref} | ||
className={cn(navigationMenuTriggerStyle(), "group", className)} | ||
{...props} | ||
> | ||
{children}{" "} | ||
<ChevronDown | ||
className="relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180" | ||
aria-hidden="true" | ||
/> | ||
</NavigationMenuPrimitive.Trigger> | ||
)); | ||
NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName; | ||
|
||
const NavigationMenuContent = React.forwardRef< | ||
React.ElementRef<typeof NavigationMenuPrimitive.Content>, | ||
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content> | ||
>(({ className, ...props }, ref) => ( | ||
<NavigationMenuPrimitive.Content | ||
ref={ref} | ||
className={cn( | ||
"data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 left-0 top-0 w-full md:absolute md:w-auto ", | ||
className, | ||
)} | ||
{...props} | ||
/> | ||
)); | ||
NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName; | ||
|
||
const NavigationMenuLink = NavigationMenuPrimitive.Link; | ||
|
||
const NavigationMenuViewport = React.forwardRef< | ||
React.ElementRef<typeof NavigationMenuPrimitive.Viewport>, | ||
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport> | ||
>(({ className, ...props }, ref) => ( | ||
<div className={cn("absolute left-0 top-full flex justify-center")}> | ||
<NavigationMenuPrimitive.Viewport | ||
className={cn( | ||
"origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow-lg md:w-[var(--radix-navigation-menu-viewport-width)]", | ||
className, | ||
)} | ||
ref={ref} | ||
{...props} | ||
/> | ||
</div> | ||
)); | ||
NavigationMenuViewport.displayName = NavigationMenuPrimitive.Viewport.displayName; | ||
|
||
const NavigationMenuIndicator = React.forwardRef< | ||
React.ElementRef<typeof NavigationMenuPrimitive.Indicator>, | ||
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator> | ||
>(({ className, ...props }, ref) => ( | ||
<NavigationMenuPrimitive.Indicator | ||
ref={ref} | ||
className={cn( | ||
"data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden", | ||
className, | ||
)} | ||
{...props} | ||
> | ||
<div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" /> | ||
</NavigationMenuPrimitive.Indicator> | ||
)); | ||
NavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName; | ||
|
||
export { | ||
navigationMenuTriggerStyle, | ||
NavigationMenu, | ||
NavigationMenuList, | ||
NavigationMenuItem, | ||
NavigationMenuContent, | ||
NavigationMenuTrigger, | ||
NavigationMenuLink, | ||
NavigationMenuIndicator, | ||
NavigationMenuViewport, | ||
}; |
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,7 @@ | ||
import { ChevronDown } from "lucide-react"; | ||
|
||
const OpenCloseArrow = () => ( | ||
<ChevronDown className="h-5 w-5 shrink-0 opacity-50 group-data-[state=open]:rotate-180" /> | ||
); | ||
|
||
export default OpenCloseArrow; |
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,13 @@ | ||
import LanguageSelector from "./language-selector"; | ||
import HeaderNavigation from "./navigation"; | ||
|
||
const Header = () => { | ||
return ( | ||
<div className="relative z-50 flex items-center justify-between gap-7 bg-foreground px-10"> | ||
<HeaderNavigation /> | ||
<LanguageSelector /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Header; |
Oops, something went wrong.