-
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.
- Loading branch information
Showing
7 changed files
with
84 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { twMerge } from "tailwind-merge"; | ||
import { getDropdownContext } from "@/util/contexts/dropdown"; | ||
|
||
// This is the actual dropdown | ||
export function DropdownElement({ | ||
children, | ||
className | ||
}: { | ||
children: React.ReactNode; | ||
className?: string; | ||
}) { | ||
const [, , referenceElement] = getDropdownContext(); | ||
|
||
const { top, right, left } = | ||
referenceElement?.current?.getBoundingClientRect() ?? { | ||
top: 0, | ||
bottom: 0, | ||
right: 0, | ||
left: 0 | ||
}; | ||
|
||
const centerX = left + (right - left) / 2; | ||
|
||
return ( | ||
<div | ||
className={twMerge(`fixed`, className)} | ||
style={{ left: centerX, top: top + 30 }} | ||
> | ||
{children} | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,11 +1,23 @@ | ||
import { | ||
Dropdown, | ||
DropdownContent, | ||
DropdownTrigger | ||
} from "@/components/dropdown"; | ||
import { HeaderIcon } from "@/components/header/icons/headerIcon"; | ||
import { LanguageIcon } from "@heroicons/react/24/outline"; | ||
|
||
// Client component since local storage | ||
export function LanguagePicker() { | ||
return ( | ||
<HeaderIcon className="w-8"> | ||
<LanguageIcon className="h-5" /> | ||
</HeaderIcon> | ||
<Dropdown> | ||
<DropdownTrigger> | ||
<HeaderIcon className="w-8"> | ||
<LanguageIcon className="h-5" /> | ||
</HeaderIcon> | ||
</DropdownTrigger> | ||
<DropdownContent className="flex"> | ||
<div className="bg-slate-600">wow</div> | ||
</DropdownContent> | ||
</Dropdown> | ||
); | ||
} |
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,13 @@ | ||
import { useCallback, useState } from "react"; | ||
|
||
export function useToggle( | ||
initialValue = false | ||
): [boolean, React.Dispatch<React.SetStateAction<boolean>>] { | ||
const [value, setValue] = useState(initialValue); | ||
|
||
const toggle = useCallback(() => { | ||
setValue(val => !val); | ||
}, []); | ||
|
||
return [value, toggle]; | ||
} |
05f9d39
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
robotics – ./
robotics-git-main-churroc.vercel.app
robotics-pied.vercel.app
robotics-churroc.vercel.app