Skip to content

Commit bee25d0

Browse files
committed
Use ComponentProps everywhere
1 parent 07c6695 commit bee25d0

File tree

15 files changed

+36
-43
lines changed

15 files changed

+36
-43
lines changed

website/src/components/Callout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ComponentPropsWithoutRef, ReactNode } from 'react'
1+
import type { ComponentProps, ReactNode } from 'react'
22

33
import { classNames } from '@edgeandnode/gds'
44
import { ExclamationMark, Lightbulb } from '@edgeandnode/gds/icons'
@@ -10,7 +10,7 @@ type CalloutType = (typeof calloutTypes)[number]
1010
const calloutTypes = ['note', 'tip', 'important', 'warning', 'caution'] as const
1111
const importantCalloutTypes: CalloutType[] = ['important', 'warning', 'caution']
1212

13-
interface CalloutProps extends Omit<ComponentPropsWithoutRef<'blockquote'>, 'title'> {
13+
interface CalloutProps extends Omit<ComponentProps<'blockquote'>, 'title'> {
1414
/**
1515
* Defaults to `info`, or to `important` if `data-callout-type` is set to either `important`, `warning`, or `caution`.
1616
*/
@@ -51,7 +51,7 @@ export const Callout = ({
5151
--:my-8 --:last:mb-0 -:is-[li>*]:my-4`,
5252
className,
5353
])}
54-
{...(props as ComponentPropsWithoutRef<'div'>)}
54+
{...(props as ComponentProps<'div'>)}
5555
>
5656
<div className="flex size-6 shrink-0 items-center justify-center">
5757
{variant === 'info' ? (

website/src/components/CodeBlock.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import type { ComponentPropsWithoutRef, ReactNode } from 'react'
1+
import type { ComponentProps, ReactNode } from 'react'
22

33
import { classNames, ExperimentalCodeBlock, type ExperimentalCodeBlockProps } from '@edgeandnode/gds'
44

5-
interface CodeBlockProps extends Omit<ComponentPropsWithoutRef<'pre'>, 'children'> {
5+
interface CodeBlockProps extends Omit<ComponentProps<'pre'>, 'children'> {
66
children?:
77
| ReactNode
88
| {
@@ -29,7 +29,7 @@ export const CodeBlock = ({ className, children, ...props }: CodeBlockProps) =>
2929
language={language as ExperimentalCodeBlockProps['language']}
3030
lineNumbers={lineCount > 1}
3131
className={classNames(['graph-docs-not-markdown --:my-8 --:last:mb-0 -:is-[li>*]:my-4', className])}
32-
{...(props as ComponentPropsWithoutRef<'div'>)}
32+
{...(props as ComponentProps<'div'>)}
3333
>
3434
{code}
3535
</ExperimentalCodeBlock>

website/src/components/Heading.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type ComponentPropsWithoutRef, type ElementType, useContext, useEffect } from 'react'
1+
import { type ComponentProps, type ElementType, useContext, useEffect } from 'react'
22
import { useInView } from 'react-intersection-observer'
33

44
import { classNames, ExperimentalButton } from '@edgeandnode/gds'
@@ -7,7 +7,7 @@ import { Link as LinkIcon } from '@edgeandnode/gds/icons'
77
import { useI18n } from '@/i18n'
88
import { MDXContentContext } from '@/layout'
99

10-
interface HeadingProps extends ComponentPropsWithoutRef<'h1'> {
10+
interface HeadingProps extends ComponentProps<'h1'> {
1111
as?: ElementType
1212
}
1313

website/src/components/Image.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type NextImage from 'next/image'
2-
import type { ComponentPropsWithoutRef } from 'react'
1+
import NextImage from 'next/image'
2+
import type { ComponentProps } from 'react'
33

44
import { classNames } from '@edgeandnode/gds'
55

6-
interface ImageProps extends Omit<ComponentPropsWithoutRef<'img'>, 'src'> {
7-
src?: ComponentPropsWithoutRef<typeof NextImage>['src']
6+
export interface ImageProps extends Omit<ComponentProps<'img'>, 'src'> {
7+
src?: ComponentProps<typeof NextImage>['src']
88
}
99

1010
export const Image = ({ src: passedSrc, alt, className, ...props }: ImageProps) => {

website/src/components/Navigation.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
type ComponentPropsWithoutRef,
3-
createContext,
4-
type MouseEvent,
5-
type ReactNode,
6-
useContext,
7-
useState,
8-
} from 'react'
1+
import { type ComponentProps, createContext, type MouseEvent, type ReactNode, useContext, useState } from 'react'
92

103
import {
114
ButtonOrLink,
@@ -16,7 +9,7 @@ import {
169
} from '@edgeandnode/gds'
1710
import { CaretDown } from '@edgeandnode/gds/icons'
1811

19-
export const NavigationGroup = ({ className, children, ...props }: ComponentPropsWithoutRef<'div'>) => {
12+
export const NavigationGroup = ({ className, children, ...props }: ComponentProps<'div'>) => {
2013
return (
2114
<div className={classNames(['overflow-clip border-b border-space-1500 px-4 py-2', className])} {...props}>
2215
<NavigationList>{children}</NavigationList>
@@ -28,7 +21,7 @@ export const NavigationListContext = createContext<{
2821
depth: number
2922
} | null>(null)
3023

31-
export const NavigationList = ({ className, children, ...props }: ComponentPropsWithoutRef<'ul'>) => {
24+
export const NavigationList = ({ className, children, ...props }: ComponentProps<'ul'>) => {
3225
const ancestorNavigationListContext = useContext(NavigationListContext)
3326
const depth = ancestorNavigationListContext ? ancestorNavigationListContext.depth + 1 : 0
3427

website/src/components/Table.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import type { ComponentPropsWithoutRef } from 'react'
1+
import type { ComponentProps } from 'react'
22

33
import { classNames } from '@edgeandnode/gds'
44

5-
interface TableProps extends ComponentPropsWithoutRef<'table'> {
5+
interface TableProps extends ComponentProps<'table'> {
66
variant?: 'default' | 'supported-networks'
77
}
88

website/src/components/TimeIcon.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { ComponentPropsWithoutRef } from 'react'
1+
import type { ComponentProps } from 'react'
22

33
import { classNames } from '@edgeandnode/gds'
44
import { HourglassDynamic } from '@edgeandnode/gds/icons'
55

66
import { useI18n } from '@/i18n'
77

8-
export interface TimeIconProps extends ComponentPropsWithoutRef<'div'> {
8+
export interface TimeIconProps extends ComponentProps<'div'> {
99
variant: 'reading' | 'duration'
1010
minutes: number
1111
}

website/src/components/VideoEmbed.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { ComponentPropsWithoutRef } from 'react'
1+
import type { ComponentProps } from 'react'
22

33
import { classNames } from '@edgeandnode/gds'
44

55
import { useI18n } from '@/i18n'
66

77
declare namespace VideoEmbedProps {
8-
interface BaseProps extends Omit<ComponentPropsWithoutRef<'iframe'>, 'src'> {
8+
interface BaseProps extends Omit<ComponentProps<'iframe'>, 'src'> {
99
title: string
1010
}
1111
interface SrcProps extends BaseProps {

website/src/layout/MDXContent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { useSet } from '@react-hookz/web'
22
import type { NextraMDXContent } from 'nextra'
3-
import type { ComponentPropsWithoutRef } from 'react'
3+
import type { ComponentProps } from 'react'
44

55
import { MDXContentContext } from './shared'
66
import { Template } from './Template'
77

8-
export function MDXContent({ toc: headings, children }: ComponentPropsWithoutRef<NextraMDXContent>) {
8+
export function MDXContent({ toc: headings, children }: ComponentProps<NextraMDXContent>) {
99
const headingIdsInOrAboveView = useSet<string>()
1010

1111
const markHeading = (id: string, inOrAboveView: boolean) => {

website/src/layout/templates/default/aside.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { motion } from 'motion/react'
2-
import { type ComponentPropsWithoutRef, type CSSProperties, useContext } from 'react'
2+
import { type ComponentProps, type CSSProperties, useContext } from 'react'
33

44
import { ButtonOrLink, reactNodeToString } from '@edgeandnode/gds'
55

66
import { useI18n } from '@/i18n'
77

88
import { LayoutContext, MAX_HEADING_DEPTH, MDXContentContext } from '../../shared'
99

10-
export default function TemplateDefaultAside(props: ComponentPropsWithoutRef<'div'>) {
10+
export default function TemplateDefaultAside(props: ComponentProps<'div'>) {
1111
const { activeIndex } = useContext(LayoutContext)!
1212
const { headings, headingIsInOrAboveView } = useContext(MDXContentContext)!
1313
const { t } = useI18n()

0 commit comments

Comments
 (0)