Skip to content

Commit

Permalink
add code example
Browse files Browse the repository at this point in the history
  • Loading branch information
haaarshsingh committed Jul 18, 2024
1 parent 8130d9b commit fe6332d
Show file tree
Hide file tree
Showing 28 changed files with 648 additions and 184 deletions.
2 changes: 1 addition & 1 deletion apps/examples/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { FC, ReactNode } from "react";

export default (({ children }) => (
<html lang="en" suppressHydrationWarning>
<body className={clsx("bg-slate-50")}>{children}</body>
<body className={clsx("bg-neutral-50")}>{children}</body>
</html>
)) as FC<{ children: ReactNode }>;
27 changes: 26 additions & 1 deletion apps/web/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@
@tailwind components;
@tailwind utilities;

:root {
--sh-identifier: #242424;
--sh-keyword: #f47067;
--sh-string: #00a99a;
--sh-class: #8d85ff;
--sh-property: #4e8fdf;
--sh-entity: #66adff;
--sh-jsxliterals: #bf7db6;
--sh-sign: #7c7c7c;
--sh-comment: #7c7c7c;
}

:root.dark {
--sh-identifier: #e6e6e6;

.dashed {
background: repeating-linear-gradient(
45deg,
#262626 0px,
#262626 6px,
transparent 6px,
transparent 9px
);
}
}

html {
scroll-behavior: smooth !important;
}
Expand Down Expand Up @@ -45,7 +71,6 @@ h3,
h4,
p,
a,
span,
button,
input,
li {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default (({ children }) => (
inter.variable,
sohne.variable,
fira_code.variable,
"bg-slate-50 dark:bg-slate-950",
"bg-neutral-50 dark:bg-neutral-950",
)}
>
<Providers>{children}</Providers>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default () => (
<main className="flex h-screen items-center justify-center">
<h1 className="text-9xl font-bold text-slate-950 dark:text-slate-50">
<h1 className="text-9xl font-bold text-neutral-950 dark:text-neutral-50">
404
</h1>
</main>
Expand Down
2 changes: 2 additions & 0 deletions apps/web/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Cursor from "../components/Cursor";
import Demo from "../components/Demo";
import Footer from "../components/Footer";
import Hero from "../components/Hero";
Expand All @@ -9,5 +10,6 @@ export default () => (
<Hero />
<Demo />
<Footer />
<Cursor />
</>
);
3 changes: 2 additions & 1 deletion apps/web/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { useEffect, useState, type FC, type ReactNode } from "react";
import { ThemeProvider } from "next-themes";
import { CursorProvider } from "react-pointers";

export default (({ children }) => {
const [mounted, setMounted] = useState(false);
Expand All @@ -11,7 +12,7 @@ export default (({ children }) => {

return (
<ThemeProvider defaultTheme="system" enableSystem attribute="class">
{children}
<CursorProvider>{children}</CursorProvider>
</ThemeProvider>
);
}) as FC<{ children: ReactNode }>;
26 changes: 26 additions & 0 deletions apps/web/components/Cursor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use client";

import Image from "next/image";
import { Cursor, CursorProps } from "react-pointers";

export default () => {
const props: CursorProps = {
default: { cursor: <PixelArtDefault /> },
pointer: { cursor: <PixelArtPointer />, query: ["button", "a"] },
wait: { cursor: <PixelArtLoading />, query: [".loading"] },
};

return <Cursor {...props} />;
};

const PixelArtDefault = () => (
<Image width={24} height={24} src="/cursors/pixel-art/default.png" alt="" />
);

const PixelArtPointer = () => (
<Image width={24} height={24} src="/cursors/pixel-art/pointer.png" alt="" />
);

const PixelArtLoading = () => (
<Image width={24} height={24} src="/cursors/pixel-art/loading.png" alt="" />
);
Loading

0 comments on commit fe6332d

Please sign in to comment.