-
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 #13528 from ethereum/homepage
Homepage redesign
- Loading branch information
Showing
79 changed files
with
3,188 additions
and
1,806 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,76 @@ | ||
import { type ReactNode } from "react" | ||
import { useRouter } from "next/router" | ||
import { useTranslation } from "next-i18next" | ||
import { MdInfoOutline } from "react-icons/md" | ||
|
||
import { cn } from "@/lib/utils/cn" | ||
import { isValidDate } from "@/lib/utils/date" | ||
|
||
import Tooltip from "../Tooltip" | ||
import Link from "../ui/Link" | ||
|
||
type BigNumberProps = { | ||
children: ReactNode | ||
value?: ReactNode | ||
sourceName?: string | ||
sourceUrl?: string | ||
lastUpdated?: number | string | ||
className?: string | ||
} | ||
|
||
const BigNumber = ({ | ||
children, | ||
value, | ||
sourceName, | ||
sourceUrl, | ||
lastUpdated, | ||
className, | ||
}: BigNumberProps) => { | ||
const { t } = useTranslation("common") | ||
const { locale } = useRouter() | ||
const lastUpdatedDisplay = | ||
lastUpdated && isValidDate(lastUpdated) | ||
? new Intl.DateTimeFormat(locale, { | ||
dateStyle: "medium", | ||
}).format(new Date(lastUpdated)) | ||
: "" | ||
return ( | ||
<div | ||
className={cn( | ||
"flex flex-1 shrink-0 flex-col self-stretch py-8", | ||
className | ||
)} | ||
> | ||
{value ? ( | ||
<> | ||
<div className="text-5xl font-bold">{value}</div> | ||
<div className="text-sm"> | ||
{children} | ||
{sourceName && sourceUrl && ( | ||
<Tooltip | ||
content={ | ||
<> | ||
<p> | ||
{t("data-provided-by")}{" "} | ||
<Link href={sourceUrl}>{sourceName}</Link> | ||
</p> | ||
{lastUpdated && ( | ||
<p className="mt-2"> | ||
{t("last-updated")}: {lastUpdatedDisplay} | ||
</p> | ||
)} | ||
</> | ||
} | ||
> | ||
<MdInfoOutline className="mb-0.5 ms-2 inline align-text-bottom" /> | ||
</Tooltip> | ||
)} | ||
</div> | ||
</> | ||
) : ( | ||
<span className="text-3xl">{t("loading-error-refresh")}</span> | ||
)} | ||
</div> | ||
) | ||
} | ||
export default BigNumber |
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,73 @@ | ||
import { cva, VariantProps } from "class-variance-authority" | ||
import type { FC, ReactNode, SVGProps } from "react" | ||
|
||
import { cn } from "@/lib/utils/cn" | ||
|
||
import { BaseLink } from "../ui/Link" | ||
|
||
type SvgButtonLinkProps = { | ||
Svg: FC<SVGProps<SVGElement>> | ||
label?: string | ||
children: ReactNode | ||
href: string | ||
className?: string | ||
size?: number | ||
} | ||
|
||
const variants = cva("flex items-center gap-3.5", { | ||
variants: { | ||
variant: { | ||
col: "flex-col text-center [&_.body]:text-center", | ||
row: "flex-row text-start [&_.body]:text-start [&_.header]:self-start", | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: "row", | ||
}, | ||
}) | ||
|
||
type Variants = VariantProps<typeof variants> | ||
|
||
const SvgButtonLink = ({ | ||
label, | ||
children, | ||
Svg, | ||
className, | ||
variant, | ||
...props | ||
}: SvgButtonLinkProps & Variants) => ( | ||
<BaseLink | ||
className={cn( | ||
"group rounded-2xl no-underline focus:outline focus:outline-4 focus:outline-offset-8", | ||
className | ||
)} | ||
hideArrow | ||
{...props} | ||
> | ||
<div className={cn(variants({ variant }))}> | ||
<div | ||
className={cn( | ||
"header", | ||
"relative grid aspect-square size-[5em] shrink-0 place-items-center", | ||
"rounded-2xl border shadow-svg-button-link transition-all duration-200", | ||
"group-hover:shadow-svg-button-link-hover group-hover:transition-all group-hover:duration-200", | ||
"group-focus:shadow-none group-focus:transition-all group-focus:duration-200" | ||
)} | ||
> | ||
<Svg | ||
className={cn( | ||
"group-hover:rotate-3 group-hover:scale-110", | ||
"group-focus:rotate-3 group-focus:scale-110", | ||
"text-4xl duration-200 group-hover:duration-200 group-focus:rotate-3" | ||
)} | ||
/> | ||
</div> | ||
<div className="body"> | ||
{label && <p className="text-xl font-bold">{label}</p>} | ||
{children} | ||
</div> | ||
</div> | ||
</BaseLink> | ||
) | ||
|
||
export default SvgButtonLink |
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,21 @@ | ||
import { MdChevronLeft, MdChevronRight } from "react-icons/md" | ||
|
||
import { cn } from "@/lib/utils/cn" | ||
|
||
import { useRtlFlip } from "@/hooks/useRtlFlip" | ||
|
||
export const ChevronNext = ({ | ||
className, | ||
...props | ||
}: React.HTMLAttributes<SVGElement>) => { | ||
const { twFlipForRtl } = useRtlFlip() | ||
return <MdChevronRight className={cn(className, twFlipForRtl)} {...props} /> | ||
} | ||
|
||
export const ChevronPrev = ({ | ||
className, | ||
...props | ||
}: React.HTMLAttributes<SVGElement>) => { | ||
const { twFlipForRtl } = useRtlFlip() | ||
return <MdChevronLeft className={cn(className, twFlipForRtl)} {...props} /> | ||
} |
Oops, something went wrong.