Skip to content

Commit

Permalink
fix: Add an interactive state to the summary. Update lockfile and com…
Browse files Browse the repository at this point in the history
…ponent folding.

Summary component was not handling internal interactive state. The section now toggles open/closed when clicked. Also, an open attribute is added via useState in summary.tsx. Additionally, indentation inconsistencies in pnpm-lock.yaml were addressed and cleaned up. These updates enhance usability and efficiency, and improve the readability of the pnpm-lock file.

Signed-off-by: prisis <d.bannert@anolilab.de>
  • Loading branch information
prisis committed Jul 29, 2023
1 parent 465890d commit 4eec888
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 42 deletions.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@visulima/readdir": "workspace:*",
"clsx": "^2.0.0",
"fathom-client": "^3.5.0",
"framer-motion": "^10.14.0",
"framer-motion": "^10.15.0",
"fs-extra": "^11.1.1",
"lucide-react": "^0.263.1",
"next": "13.4.8",
Expand Down
10 changes: 5 additions & 5 deletions docs/scripts/import-package-documentation.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import fs from "node:fs";
import path from "node:path";
import process from "node:process";
import { walk } from "@visulima/readdir";
// eslint-disable-next-line n/file-extension-in-import

import yargs from "yargs/yargs";
// eslint-disable-next-line n/file-extension-in-import

import { hideBin } from "yargs/helpers";
import fs from "node:fs";
import fse from "fs-extra";
import path from "node:path";
import process from "node:process";
// eslint-disable-next-line import/no-extraneous-dependencies
import symlinkDir from "symlink-dir";

Expand Down
2 changes: 1 addition & 1 deletion docs/src/env/env-client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// eslint-disable-next-line unicorn/prevent-abbreviations
import { env as process_environment } from "process";
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";
import { env as process_environment } from "process";

const isProduction = process_environment.NODE_ENV === "production";

Expand Down
2 changes: 1 addition & 1 deletion examples/nextra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"eslint": "8.46.0",
"eslint-config-next": "13.4.12",
"focus-visible": "^5.2.0",
"framer-motion": "^10.14.0",
"framer-motion": "^10.15.0",
"intersection-observer": "^0.12.2",
"isomorphic-git": "1.24.5",
"markdown-to-jsx": "^7.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/nextra-theme-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"next-seo": "^6.1.0",
"next-themes": "^0.2.1",
"react-hot-toast": "^2.4.1",
"react-medium-image-zoom": "^5.1.6",
"react-medium-image-zoom": "^5.1.7",
"react-wrap-balancer": "^1.0.0",
"scroll-into-view-if-needed": "^3.0.10",
"tailwind-merge": "^1.14.0"
Expand Down
7 changes: 7 additions & 0 deletions packages/nextra-theme-docs/src/components/summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import cn from "clsx";
import { ArrowRightIcon } from "nextra/icons";
import type { ComponentProps, ReactElement } from "react";

import { useState } from "react";
import { useDetails } from "../contexts";

const Summary = ({
Expand All @@ -17,6 +18,7 @@ const Summary = ({
variant?: "default" | "raw";
}): ReactElement => {
const setOpen = useDetails();
const [open, setOpenState] = useState(false);

return (
<summary
Expand All @@ -26,11 +28,16 @@ const Summary = ({
"rtl:before:rotate-180 [[data-expanded]>&]:before:rotate-90",
className,
)}
aria-expanded={open ? "true" : "false"}
role="button"
tabIndex={0}
// eslint-disable-next-line react/jsx-props-no-spreading
{...properties}
onClick={(event) => {
event.preventDefault();

setOpen((value) => !value);
setOpenState((value) => !value);
}}
>
<ArrowRightIcon
Expand Down
32 changes: 16 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 1 addition & 16 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,5 @@

"moduleResolution": "node"
},
"exclude": [
"dist/**/*",
"node_modules/**/*",
"build/**/*",
"scripts/**/*",
"verify-node-version.cjs",
"plopfile.js",
"plop/**/*",
"packages/**/dist/**/*",
"packages/**/__fixtures__/**/*",
"packages/**/__tests__/**/*",
"packages/**/bench/**/*",
"examples/**",
"docs/**",
"**/coverage/**/*"
]
"exclude": ["dist/**/*", "node_modules/**/*", "build/**/*", "scripts/**/*", "verify-node-version.cjs", "examples/**", "**/coverage/**"]
}
18 changes: 17 additions & 1 deletion tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,21 @@
"compilerOptions": {
"baseUrl": "."
},
"include": ["tsup.config.ts"]
"include": ["tsup.config.ts"],
"exclude": [
"dist/**/*",
"node_modules/**/*",
"build/**/*",
"scripts/**/*",
"verify-node-version.cjs",
"plopfile.js",
"plop/**",
"packages/**/__fixtures__/**/*",
"packages/**/__tests__/**/*",
"packages/**/bench/**/*",
"packages/**/coverage/**/*",
"packages/**/dist/**/*",
"examples/**/*",
"docs/**/*"
]
}

0 comments on commit 4eec888

Please sign in to comment.