Skip to content

Commit

Permalink
fix: anchor link for events
Browse files Browse the repository at this point in the history
  • Loading branch information
iCrawl committed Mar 3, 2024
1 parent 9fa115d commit 0efd1be
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 57 deletions.
6 changes: 5 additions & 1 deletion apps/website/src/components/ConstructorNode.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { VscSymbolMethod } from '@react-icons/all-files/vsc/VscSymbolMethod';
import { Code2, LinkIcon } from 'lucide-react';
import Link from 'next/link';
import { ENV } from '~/util/env';
import { ParameterNode } from './ParameterNode';
import { SummaryNode } from './SummaryNode';

Expand All @@ -13,7 +14,10 @@ export async function ConstructorNode({ node, version }: { readonly node: any; r
</h2>

<div className="flex place-content-between place-items-center">
<h3 id="constructor" className="group scroll-mt-8 break-words font-mono font-semibold">
<h3
id="constructor"
className={`${ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-16' : 'scroll-mt-8'} group break-words font-mono font-semibold`}
>
{/* constructor({parsedContent.constructor.parametersString}) */}
<Link href="#constructor" className="float-left -ml-6 hidden pb-2 pr-2 group-hover:block">
<LinkIcon aria-hidden size={16} />
Expand Down
6 changes: 5 additions & 1 deletion apps/website/src/components/EnumMemberNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { VscSymbolEnumMember } from '@react-icons/all-files/vsc/VscSymbolEnumMem
import { Code2, LinkIcon } from 'lucide-react';
import Link from 'next/link';
import { Fragment } from 'react';
import { ENV } from '~/util/env';
import { Badges } from './Badges';
import { DeprecatedNode } from './DeprecatedNode';
import { ExampleNode } from './ExampleNode';
Expand Down Expand Up @@ -34,7 +35,10 @@ export async function EnumMemberNode({
<Fragment key={`${enumMember.displayName}-${idx}`}>
<div className="flex flex-col gap-4">
<div className="flex place-content-between place-items-center">
<h3 id={enumMember.displayName} className="group scroll-mt-8 break-words font-mono font-semibold">
<h3
id={enumMember.displayName}
className={`${ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-16' : 'scroll-mt-8'} group break-words font-mono font-semibold`}
>
<Badges node={enumMember} />
<span>
<Link
Expand Down
27 changes: 17 additions & 10 deletions apps/website/src/components/EventNode.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { VscSymbolEvent } from '@react-icons/all-files/vsc/VscSymbolEvent';
import { ChevronDown, ChevronUp, Code2 } from 'lucide-react';
import { ChevronDown, ChevronUp, Code2, LinkIcon } from 'lucide-react';
import Link from 'next/link';
import { ENV } from '~/util/env';
import { Badges } from './Badges';
import { DeprecatedNode } from './DeprecatedNode';
import { ExampleNode } from './ExampleNode';
Expand Down Expand Up @@ -29,17 +31,22 @@ async function EventBodyNode({
<div className="flex place-content-between place-items-center">
<h3
id={event.displayName}
className={`${overload ? 'scroll-mt-16' : 'scroll-mt-8'} break-words font-mono font-semibold`}
className={`${overload ? (ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-24' : 'scroll-mt-16') : ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-16' : 'scroll-mt-8'} group break-words font-mono font-semibold`}
>
<Badges node={event} /> {event.displayName}
{event.typeParameters?.length ? (
<>
{'<'}
<TypeParameterNode node={event.typeParameters} version={version} />
{'>'}
</>
) : null}
({event.parameters?.length ? <ParameterNode node={event.parameters} version={version} /> : null})
<span>
<Link href={`#${event.displayName}`} className="float-left -ml-6 hidden pb-2 pr-2 group-hover:block">
<LinkIcon aria-hidden size={16} />
</Link>
{event.typeParameters?.length ? (
<>
{'<'}
<TypeParameterNode node={event.typeParameters} version={version} />
{'>'}
</>
) : null}
({event.parameters?.length ? <ParameterNode node={event.parameters} version={version} /> : null})
</span>
</h3>

<a
Expand Down
3 changes: 2 additions & 1 deletion apps/website/src/components/MethodNode.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { VscSymbolMethod } from '@react-icons/all-files/vsc/VscSymbolMethod';
import { ChevronDown, ChevronUp, Code2, LinkIcon } from 'lucide-react';
import Link from 'next/link';
import { ENV } from '~/util/env';
import { Badges } from './Badges';
import { DeprecatedNode } from './DeprecatedNode';
import { ExampleNode } from './ExampleNode';
Expand Down Expand Up @@ -31,7 +32,7 @@ async function MethodBodyNode({
<div className="flex place-content-between place-items-center">
<h3
id={method.displayName}
className={`${overload ? 'scroll-mt-16' : 'scroll-mt-8'} group break-words font-mono font-semibold`}
className={`${overload ? (ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-24' : 'scroll-mt-16') : ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-16' : 'scroll-mt-8'} group break-words font-mono font-semibold`}
>
<Badges node={method} /> {method.displayName}
<span>
Expand Down
3 changes: 2 additions & 1 deletion apps/website/src/components/PropertyNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { VscSymbolProperty } from '@react-icons/all-files/vsc/VscSymbolProperty'
import { ChevronDown, ChevronUp, Code2, LinkIcon } from 'lucide-react';
import Link from 'next/link';
import { Fragment } from 'react';
import { ENV } from '~/util/env';
import { Badges } from './Badges';
import { DeprecatedNode } from './DeprecatedNode';
import { ExcerptNode } from './ExcerptNode';
Expand Down Expand Up @@ -39,7 +40,7 @@ export async function PropertyNode({
<div className="flex place-content-between place-items-center">
<h3
id={property.displayName}
className="group flex scroll-mt-8 flex-col gap-2 break-words font-mono font-semibold"
className={`${ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-16' : 'scroll-mt-8'} group flex flex-col gap-2 break-words font-mono font-semibold`}
>
<Badges node={property} />
<span>
Expand Down
6 changes: 5 additions & 1 deletion apps/website/src/components/TypeParameterNode.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { LinkIcon } from 'lucide-react';
import Link from 'next/link';
import { Fragment } from 'react';
import { ENV } from '~/util/env';
import { Badges } from './Badges';
import { DocNode } from './DocNode';
import { ExcerptNode } from './ExcerptNode';
Expand All @@ -20,7 +21,10 @@ export async function TypeParameterNode({
return (
<Fragment key={`${typeParameter.name}-${idx}`}>
<div className={description ? '' : 'inline after:content-[",_"] last-of-type:after:content-none'}>
<h3 id={typeParameter.name} className="group inline scroll-mt-8 break-words font-mono font-semibold">
<h3
id={typeParameter.name}
className={`${ENV.IS_LOCAL_DEV || ENV.IS_PREVIEW ? 'scroll-mt-16' : 'scroll-mt-8'} group inline break-words font-mono font-semibold`}
>
{description ? <Badges node={typeParameter} /> : null}
<span>
{description ? (
Expand Down
2 changes: 1 addition & 1 deletion packages/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"meilisearch": "^0.37.0",
"p-limit": "^5.0.0",
"tslib": "^2.6.2",
"undici": "6.6.2"
"undici": "6.7.0"
},
"devDependencies": {
"@types/node": "18.18.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"fast-deep-equal": "3.1.3",
"lodash.snakecase": "4.1.1",
"tslib": "2.6.2",
"undici": "6.6.2",
"undici": "6.7.0",
"ws": "8.16.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/docgen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"commander": "^12.0.0",
"jsdoc-to-markdown": "^8.0.1",
"tslib": "^2.6.2",
"typedoc": "^0.25.9"
"typedoc": "^0.25.10"
},
"devDependencies": {
"@favware/cliff-jumper": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@discordjs/rest": "workspace:^",
"@discordjs/util": "workspace:^",
"tslib": "^2.6.2",
"undici": "6.6.2"
"undici": "6.7.0"
},
"devDependencies": {
"@discordjs/api-extractor": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"discord-api-types": "0.37.61",
"magic-bytes.js": "^1.8.0",
"tslib": "^2.6.2",
"undici": "6.6.2"
"undici": "6.7.0"
},
"devDependencies": {
"@discordjs/api-extractor": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@vercel/postgres": "^0.7.2",
"commander": "^12.0.0",
"tslib": "^2.6.2",
"undici": "6.6.2",
"undici": "6.7.0",
"yaml": "2.4.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"tsup": "^8.0.2",
"turbo": "^1.12.4",
"typescript": "^5.3.3",
"undici": "6.6.2",
"undici": "6.7.0",
"vitest": "^1.3.1",
"zlib-sync": "^0.1.9"
},
Expand Down
Loading

0 comments on commit 0efd1be

Please sign in to comment.