Skip to content

Commit

Permalink
Merge branch 'master' into feature/improve-use-intersection-observer
Browse files Browse the repository at this point in the history
  • Loading branch information
juliencrn committed Feb 5, 2024
2 parents b430601 + 6ec6648 commit 21ed1de
Show file tree
Hide file tree
Showing 40 changed files with 1,149 additions and 2,168 deletions.
9 changes: 9 additions & 0 deletions .changeset/eight-buses-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'usehooks-ts': minor
---

Improve `useOnClickOutside`:

- Prevent handling callback when clicking on a not connected element (#374 by @hooriza)
- Add support to accept multiple references
- Add support for touch events in addition to mouse events
7 changes: 7 additions & 0 deletions .changeset/empty-waves-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"eslint-config-custom": minor
"usehooks-ts": minor
"www": minor
---

chore: Updated dependencies
5 changes: 5 additions & 0 deletions .changeset/giant-shrimps-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'usehooks-ts': patch
---

fix: `useScript` failed to remove script from cache when passing `removeOnUnmount` prop (#354 by @ShanSenanayake)
5 changes: 5 additions & 0 deletions .changeset/heavy-numbers-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"www": minor
---

various improvements to the site
5 changes: 5 additions & 0 deletions .changeset/old-dragons-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"usehooks-ts": patch
---

use tsup as bundler instead of transpiling with tsc (@BlankParticle)
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- '**'
pull_request:

env:
NODE_VERSION: 20
Expand Down
15 changes: 1 addition & 14 deletions apps/www/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
import './env.mjs'

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
transpilePackages: ['lucide-react'],

// Allow fs
// webpack(config) {
// config.resolve.fallback = { ...config.resolve.fallback, fs: false }
// return config
// },
experimental: {
mdxRs: true,
},
}
const nextConfig = {}

export default nextConfig
7 changes: 3 additions & 4 deletions apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@
"generate": "cd ../.. && pnpm copy-hooks && cd -"
},
"dependencies": {
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@next/third-parties": "^14.1.0",
"@radix-ui/react-slot": "^1.0.2",
"@t3-oss/env-nextjs": "^0.8.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"date-fns": "^3.3.1",
"gray-matter": "^4.0.3",
"highlight.js": "^11.9.0",
"lucide-react": "^0.316.0",
"lucide-react": "^0.319.0",
"next": "14.1.0",
"next-mdx-remote": "^4.4.1",
"next-themes": "^0.2.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"rehype-highlight": "^7.0.0",
Expand All @@ -37,7 +36,7 @@
"devDependencies": {
"@tailwindcss/line-clamp": "^0.4.4",
"@tailwindcss/typography": "^0.5.10",
"@types/node": "20.11.10",
"@types/node": "20.11.13",
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
"autoprefixer": "10.4.17",
Expand Down
6 changes: 2 additions & 4 deletions apps/www/src/app/(docs)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import '../globals.css'

import Link from 'next/link'

import { Icons } from '@/components/icons'
import { GitHub } from '@/components/icons'
import { MainNav } from '@/components/main-nav'
import { ModeToggle } from '@/components/mode-toggle'
// import { DocsSearch } from "@/components/search"
import { DocsSidebarNav } from '@/components/sidebar-nav'
import { docsConfig } from '@/config/docs'
Expand All @@ -31,10 +30,9 @@ export default function DocsLayout({ children }: DocsLayoutProps) {
rel="noreferrer"
className="flex"
>
<Icons.gitHub className="h-6 w-6 my-auto" />
<GitHub className="h-6 w-6 my-auto" />
<span className="sr-only">GitHub</span>
</Link>
<ModeToggle />
</nav>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/app/(docs)/react-hook/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const PostLayout = ({ params }: { params: { slug: string } }) => {

return (
<main className="relative py-6 lg:gap-10 lg:py-10 xl:grid xl:grid-cols-[1fr_300px]">
<div className="mx-auto w-full min-w-0">
<div className="mx-auto w-full min-w-0 grid">
<DocsPageHeader
id="introduction"
className="scroll-m-20"
Expand Down
6 changes: 2 additions & 4 deletions apps/www/src/app/(marketing)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Link from 'next/link'

import { Icons } from '@/components/icons'
import { GitHub } from '@/components/icons'
import { MainNav } from '@/components/main-nav'
import { ModeToggle } from '@/components/mode-toggle'
import { marketingConfig } from '@/config/marketing'
import { siteConfig } from '@/config/site'

Expand All @@ -25,10 +24,9 @@ export default async function MarketingLayout({
rel="noreferrer"
className="flex"
>
<Icons.gitHub className="h-6 w-6 my-auto" />
<GitHub className="h-6 w-6 my-auto" />
<span className="sr-only">GitHub</span>
</Link>
<ModeToggle />
</nav>
</div>
</header>
Expand Down
24 changes: 16 additions & 8 deletions apps/www/src/app/(marketing)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import type { LucideIcon } from 'lucide-react'
import Link from 'next/link'

import { Icons } from '@/components/icons'
import {
Code,
GitHub,
Globe,
Leaf,
Puzzle,
Unplug,
Zap,
} from '@/components/icons'
import { buttonVariants } from '@/components/ui/button'
import { siteConfig } from '@/config/site'
import { cn } from '@/lib/utils'
Expand All @@ -14,37 +22,37 @@ type Feature = {

const features: Feature[] = [
{
icon: Icons.zap,
icon: Zap,
title: 'Lightweight',
content:
'usehooks-ts is a tiny library without any dependencies, ensuring a lean and efficient solution.',
},
{
icon: Icons.unplug,
icon: Unplug,
title: 'Type-Safe',
content:
'Catch compile-time errors with ease and unlock strong typing benefits.',
},
{
icon: Icons.leaf,
icon: Leaf,
title: 'Tree-Shakable',
content:
'Eliminating unused code and delivering leaner bundles for lightning-fast load times.',
},
{
icon: Icons.puzzle,
icon: Puzzle,
title: 'Easy to Use',
content:
'Get started in no time! Explore comprehensive documentation and rich examples.',
},
{
icon: Icons.code,
icon: Code,
title: 'Developer-Friendly',
content:
"Simplify development with an intuitive and powerful API. Don't repeat yourself.",
},
{
icon: Icons.globe,
icon: Globe,
title: 'Open-Source',
content:
'Join the vibrant community! Collaborate, contribute, and unlock endless possibilities together.',
Expand Down Expand Up @@ -173,7 +181,7 @@ export default async function IndexPage() {
className="flex"
>
<div className="flex h-10 w-10 items-center justify-center space-x-2 rounded-md border border-muted bg-muted">
<Icons.gitHub className="h-6 w-6" />
<GitHub className="h-6 w-6" />
</div>
<div className="flex items-center">
<div className="h-4 w-4 border-y-8 border-l-0 border-r-8 border-solid border-muted border-y-transparent"></div>
Expand Down
54 changes: 33 additions & 21 deletions apps/www/src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
@tailwind components;
@tailwind utilities;

@import 'highlight.js/styles/github.css' screen;
@import 'highlight.js/styles/github-dark.css' screen and
(prefers-color-scheme: dark);

@layer base {
:root {
--background: 0 0% 100%;
Expand Down Expand Up @@ -36,37 +40,39 @@
--radius: 0.5rem;
}

.dark {
--background: 224 71% 4%;
--foreground: 213 31% 91%;
@media (prefers-color-scheme: dark) {
:root {
--background: 224 71% 4%;
--foreground: 213 31% 91%;

--muted: 223 47% 11%;
--muted-foreground: 215.4 16.3% 56.9%;
--muted: 223 47% 11%;
--muted-foreground: 215.4 16.3% 56.9%;

--popover: 224 71% 4%;
--popover-foreground: 215 20.2% 65.1%;
--popover: 224 71% 4%;
--popover-foreground: 215 20.2% 65.1%;

--card: 224 71% 4%;
--card-foreground: 213 31% 91%;
--card: 224 71% 4%;
--card-foreground: 213 31% 91%;

--border: 216 34% 17%;
--input: 216 34% 17%;
--border: 216 34% 17%;
--input: 216 34% 17%;

--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 1.2%;
--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 1.2%;

--secondary: 222.2 47.4% 11.2%;
--secondary-foreground: 210 40% 98%;
--secondary: 222.2 47.4% 11.2%;
--secondary-foreground: 210 40% 98%;

--accent: 216 34% 17%;
--accent-foreground: 210 40% 98%;
--accent: 216 34% 17%;
--accent-foreground: 210 40% 98%;

--destructive: 0 63% 31%;
--destructive-foreground: 210 40% 98%;
--destructive: 0 63% 31%;
--destructive-foreground: 210 40% 98%;

--ring: 216 34% 17%;
--ring: 216 34% 17%;

--radius: 0.5rem;
--radius: 0.5rem;
}
}
}

Expand All @@ -76,6 +82,12 @@
}
html {
scroll-behavior: smooth;

color-scheme: light;

@media (prefers-color-scheme: dark) {
color-scheme: dark;
}
}
body {
@apply bg-background text-foreground;
Expand Down
13 changes: 6 additions & 7 deletions apps/www/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { GoogleAnalytics } from '@next/third-parties/google'
import type { Metadata, Viewport } from 'next'
import { Inter as FontSans } from 'next/font/google'
import localFont from 'next/font/local'

import './globals.css'
import { Analytics } from '@/components/analytics'
import { ThemeProvider } from '@/components/theme-provider'
import { siteConfig } from '@/config/site'
import { cn } from '@/lib/utils'

Expand Down Expand Up @@ -74,7 +73,6 @@ export const metadata: Metadata = {
export default function RootLayout({ children }: RootLayoutProps) {
return (
<html lang="en" suppressHydrationWarning>
<head></head>
<body
suppressHydrationWarning
className={cn(
Expand All @@ -83,10 +81,11 @@ export default function RootLayout({ children }: RootLayoutProps) {
fontHeading.variable,
)}
>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
{children}
<Analytics />
</ThemeProvider>
{children}

{process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID && (
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID} />
)}
</body>
</html>
)
Expand Down
28 changes: 0 additions & 28 deletions apps/www/src/components/analytics.tsx

This file was deleted.

Loading

0 comments on commit 21ed1de

Please sign in to comment.