Skip to content

Commit e3f4131

Browse files
committed
docs: fix linting errors in stories and remove any types in AppShell
1 parent cd1b899 commit e3f4131

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

packages/react/src/AppShell.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
"use client";
22

3-
import { memo, Children, isValidElement, cloneElement, type ReactNode } from "react";
3+
import {
4+
memo,
5+
Children,
6+
isValidElement,
7+
cloneElement,
8+
type ReactNode,
9+
type ReactElement,
10+
} from "react";
411
import { cn } from "./cn";
512
import { AppShellProvider } from "./context";
613
import { SafeArea } from "./SafeArea";
714
import { Header } from "./Header";
8-
import type { AppShellProps } from "./types";
15+
import type { AppShellProps, HeaderProps } from "./types";
916

1017
function AppShellInner({ safeArea = false, className, children }: AppShellProps) {
1118
if (!safeArea) {
@@ -22,13 +29,14 @@ function AppShellInner({ safeArea = false, className, children }: AppShellProps)
2229

2330
Children.forEach(children, (child) => {
2431
if (isValidElement(child)) {
32+
const childType = child.type as { displayName?: string; name?: string };
2533
const isHeader = child.type === Header ||
26-
(child.type as any).displayName === "Header" ||
27-
(child.type as any).name === "Header";
34+
childType.displayName === "Header" ||
35+
childType.name === "Header";
2836

2937
if (isHeader) {
3038
header = child;
31-
headerBehavior = (child.props as any).behavior || "fixed";
39+
headerBehavior = (child.props as HeaderProps).behavior || "fixed";
3240
} else {
3341
otherChildren.push(child);
3442
}
@@ -55,7 +63,7 @@ function AppShellInner({ safeArea = false, className, children }: AppShellProps)
5563
return (
5664
<div className={cn("flex min-h-dvh flex-col relative", className)}>
5765
{header && isValidElement(header)
58-
? cloneElement(header as any, { forceSafeAreaTop: true })
66+
? cloneElement(header as ReactElement<HeaderProps>, { forceSafeAreaTop: true })
5967
: header}
6068
<SafeArea edges={["bottom"]} className="flex flex-col flex-1">
6169
{otherChildren}

packages/react/src/Footer.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import type { Meta, StoryObj } from '@storybook/react';
2+
import type { Meta, StoryObj } from '@storybook/react-vite';
33
import { Footer, FooterItem } from './Footer';
44
import { AppShellProvider } from './context';
55
import { Home, Search, PlusCircle, Bell, User } from 'lucide-react';

packages/react/src/Header.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import type { Meta, StoryObj } from '@storybook/react';
2+
import type { Meta, StoryObj } from '@storybook/react-vite';
33
import { Header } from './Header';
44
import { AppShellProvider } from './context';
55
import { HeaderNav, HeaderNavItem } from './HeaderNav';

0 commit comments

Comments
 (0)