Compare commits
No commits in common. "f70b6993bcc37ff8a6eb00fb4f246e47e1265bb9" and "bc4729a5de8cc2b44af8f779add4a833865dc803" have entirely different histories.
f70b6993bc
...
bc4729a5de
@ -1,4 +1,3 @@
|
|||||||
import React from "react";
|
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
type IframeProps = {
|
type IframeProps = {
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import React from "react";
|
|
||||||
|
|
||||||
export function Image(props: { src: string; alt: string } & React.ComponentPropsWithoutRef<"img">) {
|
export function Image(props: { src: string; alt: string } & React.ComponentPropsWithoutRef<"img">) {
|
||||||
return <img {...props} src={props.src} alt={props.alt} loading="lazy" />;
|
return <img {...props} src={props.src} alt={props.alt} loading="lazy" />;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
import { usePageContext } from "vike-react/usePageContext";
|
import { usePageContext } from "vike-react/usePageContext";
|
||||||
import { prefetch } from "vike/client/router";
|
import { prefetch } from "vike/client/router";
|
||||||
import React from "react";
|
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
export function Link(props: React.AnchorHTMLAttributes<HTMLAnchorElement> & { href: string; className?: string }) {
|
export function Link(props: React.AnchorHTMLAttributes<HTMLAnchorElement> & { href: string }) {
|
||||||
const { urlPathname } = usePageContext();
|
const { urlPathname } = usePageContext();
|
||||||
const isActive = props.href === "/" ? urlPathname === props.href : urlPathname.startsWith(props.href);
|
const isActive = props.href === "/" ? urlPathname === props.href : urlPathname.startsWith(props.href);
|
||||||
const isSameDomain = !(props.href.startsWith("http") || props.href.startsWith("mailto"));
|
const isSameDomain = !(props.href.startsWith("http") || props.href.startsWith("mailto"));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { Dispatch, SetStateAction } from "react";
|
import type { Dispatch, SetStateAction } from "react";
|
||||||
|
|
||||||
import React, { createContext, useContext, useEffect, useState } from "react";
|
import { createContext, useContext, useEffect, useState } from "react";
|
||||||
import { Button } from "@syntax/Button";
|
import { Button } from "@syntax/Button";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { Link } from "@/components/common/Link";
|
import { Link } from "@/components/common/Link";
|
||||||
import React from "react";
|
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
const variantStyles = {
|
const variantStyles = {
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { ClipboardDocumentIcon } from "@heroicons/react/24/outline";
|
import { ClipboardDocumentIcon } from "@heroicons/react/24/outline";
|
||||||
import { prismThemes } from "@/data/themes/prism";
|
import { prismThemes } from "@/data/themes/prism";
|
||||||
import React, { Fragment, useMemo } from "react";
|
|
||||||
import { Highlight } from "prism-react-renderer";
|
import { Highlight } from "prism-react-renderer";
|
||||||
import { useTheme } from "@/hooks/useTheme";
|
import { useTheme } from "@/hooks/useTheme";
|
||||||
|
import { Fragment, useMemo } from "react";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import { Button } from "./Button";
|
import { Button } from "./Button";
|
||||||
import Prism from "prismjs";
|
import Prism from "prismjs";
|
||||||
@ -40,7 +40,7 @@ export default function CSRSnippet({
|
|||||||
{label}
|
{label}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<pre className={clsx(className, { "pt-11": label })} style={style}>
|
<pre className={clsx(className, { "pt-11": !!label })} style={style}>
|
||||||
<code>
|
<code>
|
||||||
{tokens.map((line, lineIndex) => (
|
{tokens.map((line, lineIndex) => (
|
||||||
<Fragment key={lineIndex}>
|
<Fragment key={lineIndex}>
|
||||||
@ -69,7 +69,7 @@ export default function CSRSnippet({
|
|||||||
<Button
|
<Button
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"absolute right-2 w-8 h-8 aspect-square opacity-0 group-hover:opacity-50 hover:opacity-100 transition-opacity",
|
"absolute right-2 w-8 h-8 aspect-square opacity-0 group-hover:opacity-50 hover:opacity-100 transition-opacity",
|
||||||
label ? "top-10" : "top-2",
|
!!label ? "top-10" : "top-2",
|
||||||
)}
|
)}
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { Icon } from "@syntax/Icon";
|
import { Icon } from "@syntax/Icon";
|
||||||
import React from "react";
|
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
@ -37,12 +36,10 @@ export function Callout({
|
|||||||
type?: keyof typeof styles;
|
type?: keyof typeof styles;
|
||||||
collapsible?: boolean;
|
collapsible?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const IconComponent = icons[type];
|
let IconComponent = icons[type];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div className={clsx("my-8 flex flex-col rounded-3xl p-6", styles[type].container)}>
|
||||||
className={clsx("my-8 flex flex-col rounded-3xl p-6", styles[type].container, { "cursor-pointer": collapsible })}
|
|
||||||
>
|
|
||||||
<div className="flex items-center gap-6">
|
<div className="flex items-center gap-6">
|
||||||
<IconComponent className="h-8 w-8 flex-none" />
|
<IconComponent className="h-8 w-8 flex-none" />
|
||||||
<p className={clsx("!m-0 font-display text-xl text-balance", styles[type].title)}>{title}</p>
|
<p className={clsx("!m-0 font-display text-xl text-balance", styles[type].title)}>{title}</p>
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { usePageContext } from "vike-react/usePageContext";
|
import { usePageContext } from "vike-react/usePageContext";
|
||||||
import { ClockIcon } from "@heroicons/react/24/outline";
|
import { ClockIcon } from "@heroicons/react/24/outline";
|
||||||
import { navigation } from "@/lib/navigation";
|
import { navigation } from "@/lib/navigation";
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
type DocsHeaderProps = {
|
type DocsHeaderProps = {
|
||||||
title?: string;
|
title?: string;
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import { PrevNextLinks } from "@syntax/PrevNextLinks";
|
|||||||
import { collectSections } from "@/lib/sections";
|
import { collectSections } from "@/lib/sections";
|
||||||
import { DocsHeader } from "@syntax/DocsHeader";
|
import { DocsHeader } from "@syntax/DocsHeader";
|
||||||
import { Prose } from "@syntax/Prose";
|
import { Prose } from "@syntax/Prose";
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
export function DocsLayout({
|
export function DocsLayout({
|
||||||
children,
|
children,
|
||||||
@ -18,7 +17,7 @@ export function DocsLayout({
|
|||||||
estimatedReadingTime?: string;
|
estimatedReadingTime?: string;
|
||||||
nodes: Array<Node>;
|
nodes: Array<Node>;
|
||||||
}) {
|
}) {
|
||||||
const tableOfContents = collectSections(nodes);
|
let tableOfContents = collectSections(nodes);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { clientOnly } from "vike-react/clientOnly";
|
import { clientOnly } from "vike-react/clientOnly";
|
||||||
import { SSRSnippet } from "./SSRSnippet";
|
import { SSRSnippet } from "./SSRSnippet";
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
const CSRSnippet = clientOnly(() => import("./CSRSnippet"));
|
const CSRSnippet = clientOnly(() => import("./CSRSnippet"));
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,8 @@ import blurIndigoImage from "@/images/blur-indigo.webp";
|
|||||||
import blurCyanImage from "@/images/blur-cyan.webp";
|
import blurCyanImage from "@/images/blur-cyan.webp";
|
||||||
import { Image } from "@/components/common/Image";
|
import { Image } from "@/components/common/Image";
|
||||||
import { Highlight } from "prism-react-renderer";
|
import { Highlight } from "prism-react-renderer";
|
||||||
import React, { Fragment } from "react";
|
|
||||||
import { Button } from "@syntax/Button";
|
import { Button } from "@syntax/Button";
|
||||||
|
import { Fragment } from "react";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
const codeLanguage = "javascript";
|
const codeLanguage = "javascript";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { useId } from "react";
|
import { useId } from "react";
|
||||||
|
|
||||||
export function HeroBackground(props: React.ComponentPropsWithoutRef<"svg">) {
|
export function HeroBackground(props: React.ComponentPropsWithoutRef<"svg">) {
|
||||||
const id = useId();
|
const id = useId();
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { PluginsIcon } from "@syntax/icons/PluginsIcon";
|
|||||||
import { PresetsIcon } from "@syntax/icons/PresetsIcon";
|
import { PresetsIcon } from "@syntax/icons/PresetsIcon";
|
||||||
import { ThemingIcon } from "@syntax/icons/ThemingIcon";
|
import { ThemingIcon } from "@syntax/icons/ThemingIcon";
|
||||||
import { WarningIcon } from "@syntax/icons/WarningIcon";
|
import { WarningIcon } from "@syntax/icons/WarningIcon";
|
||||||
import React, { useId } from "react";
|
import { useId } from "react";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
const icons = {
|
const icons = {
|
||||||
@ -32,8 +32,8 @@ export function Icon({
|
|||||||
color?: keyof typeof iconStyles;
|
color?: keyof typeof iconStyles;
|
||||||
icon: keyof typeof icons;
|
icon: keyof typeof icons;
|
||||||
} & Omit<React.ComponentPropsWithoutRef<"svg">, "color">) {
|
} & Omit<React.ComponentPropsWithoutRef<"svg">, "color">) {
|
||||||
const id = useId();
|
let id = useId();
|
||||||
const IconComponent = icons[icon];
|
let IconComponent = icons[icon];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<svg aria-hidden="true" viewBox="0 0 32 32" fill="none" className={clsx(className, iconStyles[color])} {...props}>
|
<svg aria-hidden="true" viewBox="0 0 32 32" fill="none" className={clsx(className, iconStyles[color])} {...props}>
|
||||||
|
|||||||
@ -1,6 +1,11 @@
|
|||||||
import React from "react";
|
|
||||||
|
|
||||||
function LogomarkPaths() {
|
function LogomarkPaths() {
|
||||||
|
// return (
|
||||||
|
// <g fill="none" stroke="#38BDF8" strokeLinejoin="round" strokeWidth={3}>
|
||||||
|
// <path d="M10.308 5L18 17.5 10.308 30 2.615 17.5 10.308 5z" />
|
||||||
|
// <path d="M18 17.5L10.308 5h15.144l7.933 12.5M18 17.5h15.385L25.452 30H10.308L18 17.5z" />
|
||||||
|
// </g>
|
||||||
|
// );
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<defs>
|
<defs>
|
||||||
@ -28,6 +33,25 @@ function LogomarkPaths() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function LogoWithText(props: React.ComponentPropsWithoutRef<"svg">) {
|
||||||
|
return (
|
||||||
|
<svg viewBox="0 0 231 38" {...props}>
|
||||||
|
<LogomarkPaths />
|
||||||
|
<text
|
||||||
|
className="hidden lg:block fill-zinc-900 dark:fill-zinc-100"
|
||||||
|
fontFamily="Inter Variable, sans-serif"
|
||||||
|
fontSize={24}
|
||||||
|
fontWeight="bold"
|
||||||
|
letterSpacing="-.02em"
|
||||||
|
x={74}
|
||||||
|
y={26}
|
||||||
|
>
|
||||||
|
Memento Dev
|
||||||
|
</text>
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function Logo(props: React.ComponentPropsWithoutRef<"svg">) {
|
export function Logo(props: React.ComponentPropsWithoutRef<"svg">) {
|
||||||
return (
|
return (
|
||||||
<svg viewBox="0 0 58 38" {...props}>
|
<svg viewBox="0 0 58 38" {...props}>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { Suspense, useCallback, useEffect, useState } from "react";
|
import { Suspense, useCallback, useEffect, useState } from "react";
|
||||||
import { usePageContext } from "vike-react/usePageContext";
|
import { usePageContext } from "vike-react/usePageContext";
|
||||||
import { Dialog, DialogPanel } from "@headlessui/react";
|
import { Dialog, DialogPanel } from "@headlessui/react";
|
||||||
import { Navigation } from "@syntax/Navigation";
|
import { Navigation } from "@syntax/Navigation";
|
||||||
@ -32,12 +32,11 @@ function CloseOnNavigation({ close }: { close: () => void }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function MobileNavigation() {
|
export function MobileNavigation() {
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
let [isOpen, setIsOpen] = useState(false);
|
||||||
const close = useCallback(() => setIsOpen(false), [setIsOpen]);
|
let close = useCallback(() => setIsOpen(false), [setIsOpen]);
|
||||||
|
|
||||||
function onLinkClick(event: React.MouseEvent<HTMLAnchorElement>) {
|
function onLinkClick(event: React.MouseEvent<HTMLAnchorElement>) {
|
||||||
const link = event.currentTarget;
|
let link = event.currentTarget;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
link.pathname + link.search + link.hash ===
|
link.pathname + link.search + link.hash ===
|
||||||
window.location.pathname + window.location.search + window.location.hash
|
window.location.pathname + window.location.search + window.location.hash
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid";
|
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid";
|
||||||
import { usePageContext } from "vike-react/usePageContext";
|
import { usePageContext } from "vike-react/usePageContext";
|
||||||
import React, { useEffect, useState } from "react";
|
|
||||||
import { Link } from "@/components/common/Link";
|
import { Link } from "@/components/common/Link";
|
||||||
import { navigation } from "@/lib/navigation";
|
import { navigation } from "@/lib/navigation";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
type NavigationItemProps = {
|
type NavigationItemProps = {
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { usePageContext } from "vike-react/usePageContext";
|
import { usePageContext } from "vike-react/usePageContext";
|
||||||
import { Link } from "@/components/common/Link";
|
import { Link } from "@/components/common/Link";
|
||||||
import { navigation } from "@/lib/navigation";
|
import { navigation } from "@/lib/navigation";
|
||||||
import React from "react";
|
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
function ArrowIcon(props: React.ComponentPropsWithoutRef<"svg">) {
|
function ArrowIcon(props: React.ComponentPropsWithoutRef<"svg">) {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ export function Prose<T extends React.ElementType = "div">({
|
|||||||
}: React.ComponentPropsWithoutRef<T> & {
|
}: React.ComponentPropsWithoutRef<T> & {
|
||||||
as?: T;
|
as?: T;
|
||||||
}) {
|
}) {
|
||||||
const Component = as ?? "div";
|
let Component = as ?? "div";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Component
|
<Component
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user