Skip to content

Commit 40f1b1b

Browse files
committed
chore: use ReactElement instead of JSX Element
1 parent 198c09e commit 40f1b1b

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ interface Props {
4040
aktivePage: Pages;
4141
}
4242

43-
function MyAppsSideMenu({ sykmeldt }: Props): JSX.Element {
43+
function MyAppsSideMenu({ sykmeldt }: Props): ReactElement {
4444
return (
4545
<SideMenu
4646
sykmeldtName={sykmeldt.navn}

Diff for: example/pages/_app.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import '../styles/globals.css'
22
import '@navikt/dinesykmeldte-sidemeny/dist/style.css'
33

44
import type { AppProps } from 'next/app'
5-
import { useEffect } from 'react'
5+
import { ReactElement, useEffect } from 'react'
66
import { setBreadcrumbs } from '@navikt/nav-dekoratoren-moduler'
77

8-
function MyApp({ Component, pageProps }: AppProps): JSX.Element {
8+
function MyApp({ Component, pageProps }: AppProps): ReactElement {
99
useEffect(() => {
1010
setBreadcrumbs([
1111
{ title: 'Bread', url: '/' },

Diff for: library/lib/PageContainer/PageHeader/PageHeader.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { PropsWithChildren, ReactNode } from 'react'
1+
import React, { PropsWithChildren, ReactElement, ReactNode } from 'react'
22
import { Skeleton, BodyShort, Heading } from '@navikt/ds-react'
33
import { BandageIcon } from '@navikt/aksel-icons'
44
import cn from 'clsx'
@@ -18,7 +18,7 @@ interface Props {
1818
hideHeaderOnMobile?: boolean
1919
}
2020

21-
function PageHeader({ header, headerRight, hideHeaderOnMobile, children }: PropsWithChildren<Props>): JSX.Element {
21+
function PageHeader({ header, headerRight, hideHeaderOnMobile, children }: PropsWithChildren<Props>): ReactElement {
2222
return (
2323
<>
2424
{typeof header === 'object' && (

Diff for: library/lib/SideMenu/ExpandableMobileMenu/ExpandableMobileMenu.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { PropsWithChildren } from 'react'
1+
import React, { PropsWithChildren, ReactElement } from 'react'
22
import { Accordion, BodyShort, Heading } from '@navikt/ds-react'
33
import { PersonIcon } from '@navikt/aksel-icons'
44
import cn from 'clsx'
@@ -18,7 +18,7 @@ export const ExpandableMobileMenu = ({
1818
sykmeldtFnr,
1919
children,
2020
className,
21-
}: PropsWithChildren<Props>): JSX.Element => {
21+
}: PropsWithChildren<Props>): ReactElement => {
2222
return (
2323
<Accordion className={cn(styles.accordionMobileRoot, className)}>
2424
<Accordion.Item>

Diff for: library/lib/SideMenu/MenuItem/DynamicIcon.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react'
1+
import React, { ReactElement } from 'react'
22
import { ArrowLeftIcon, BandageIcon } from '@navikt/aksel-icons'
33

44
import { NotifcationDot } from '../../NotificationDot/NotificationDot'
@@ -9,7 +9,7 @@ interface Props {
99
notifications: number
1010
}
1111

12-
function DynamicIcon({ Icon, childActive, notifications }: Props): JSX.Element {
12+
function DynamicIcon({ Icon, childActive, notifications }: Props): ReactElement {
1313
if (childActive) {
1414
return <ArrowLeftIcon role="img" aria-hidden />
1515
} else if (notifications > 0) {

Diff for: library/lib/SideMenu/MenuItem/MenuItem.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react'
1+
import React, { ReactElement } from 'react'
22
import { Button } from '@navikt/ds-react'
33
import cn from 'clsx'
44

@@ -16,7 +16,7 @@ interface Props {
1616
route: RouteVariant
1717
}
1818

19-
function MenuItem({ sykmeldtId, page, activePage, route }: Props): JSX.Element | null {
19+
function MenuItem({ sykmeldtId, page, activePage, route }: Props): ReactElement | null {
2020
// Hide if route is sett to false
2121
if (typeof route === 'boolean') return null
2222
// Also hide if custom route with hidden true

Diff for: library/lib/SideMenu/MenuItem/SubMenuItem.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import cn from 'clsx'
22
import { Label } from '@navikt/ds-react'
3-
import React from 'react'
3+
import React, { ReactElement } from 'react'
44

55
import { ChildPages } from '../../types'
66

77
import { pageToIcon } from './MenuItemUtils'
88
import styles from './SubMenuItem.module.css'
99

10-
export function SubMenuItem({ page }: { page: ChildPages }): JSX.Element {
10+
export function SubMenuItem({ page }: { page: ChildPages }): ReactElement {
1111
const Icon = pageToIcon(page)
1212

1313
return (

Diff for: library/lib/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PropsWithChildren } from 'react'
1+
import { PropsWithChildren, ReactElement } from 'react'
22

33
export enum RootPages {
44
Sykmeldinger = 'Sykmeldinger',
@@ -19,7 +19,7 @@ export enum ChildPages {
1919

2020
export type Pages = RootPages | ChildPages
2121

22-
export type Route = (props: PropsWithChildren<{ className?: string }>) => JSX.Element
22+
export type Route = (props: PropsWithChildren<{ className?: string }>) => ReactElement
2323

2424
export type RouteVariant =
2525
| number

0 commit comments

Comments
 (0)