-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13411 from ethereum/shadcn-footer-link
Shadcn migration - footer, skiplink, list & link components
- Loading branch information
Showing
10 changed files
with
317 additions
and
132 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,19 @@ | ||
import { useTranslation } from "next-i18next" | ||
import { Box } from "@chakra-ui/react" | ||
|
||
import { BaseLink } from "@/components/Link" | ||
|
||
import { MAIN_CONTENT_ID } from "@/lib/constants" | ||
|
||
import { BaseLink } from "../../tailwind/Link" | ||
|
||
export const SkipLink = () => { | ||
const { t } = useTranslation() | ||
return ( | ||
<Box bg="primary.base"> | ||
<div className="bg-primary"> | ||
<BaseLink | ||
href={"#" + MAIN_CONTENT_ID} | ||
lineHeight="taller" | ||
position="absolute" | ||
top="-12" | ||
ms="2" | ||
color="background.base" | ||
textDecorationLine="none" | ||
_hover={{ textDecoration: "none" }} | ||
_focus={{ position: "static" }} | ||
className="absolute -top-12 ms-2 leading-8 text-background no-underline hover:no-underline focus:static" | ||
> | ||
{t("skip-to-main-content")} | ||
</BaseLink> | ||
</Box> | ||
</div> | ||
) | ||
} |
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,53 @@ | ||
import { BaseHTMLAttributes, ElementRef, forwardRef } from "react" | ||
import { Slot } from "@radix-ui/react-slot" | ||
|
||
import { cn } from "@/lib/utils/cn" | ||
|
||
export type ListProps = BaseHTMLAttributes<HTMLUListElement> & { | ||
asChild?: boolean | ||
} | ||
|
||
const List = forwardRef<ElementRef<"ul">, ListProps>( | ||
({ className, asChild, ...props }, ref) => { | ||
const Comp = asChild ? Slot : "ul" | ||
return ( | ||
<Comp | ||
ref={ref} | ||
className={cn("mb-6 ms-6 list-disc", className)} | ||
{...props} | ||
/> | ||
) | ||
} | ||
) | ||
|
||
List.displayName = "List" | ||
|
||
// Alias | ||
const UnorderedList = List | ||
|
||
const OrderedList = forwardRef<ElementRef<"ol">, ListProps>( | ||
({ className, children, ...props }, ref) => ( | ||
<List className={cn("list-decimal", className)} asChild> | ||
<ol ref={ref} {...props}> | ||
{children} | ||
</ol> | ||
</List> | ||
) | ||
) | ||
|
||
OrderedList.displayName = "OrderedList" | ||
|
||
const ListItem = forwardRef< | ||
ElementRef<"li">, | ||
BaseHTMLAttributes<HTMLLIElement> | ||
>(({ className, ...props }, ref) => ( | ||
<li | ||
ref={ref} | ||
className={cn("mb-3 last:mb-0 [&_ol]:mt-3 [&_ul]:mt-3", className)} | ||
{...props} | ||
/> | ||
)) | ||
|
||
ListItem.displayName = "ListItem" | ||
|
||
export { List, ListItem, OrderedList, UnorderedList } |
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
Oops, something went wrong.