diff --git a/Storybook/components/TopAppBar/TopAppBar.stories.tsx b/Storybook/components/TopAppBar/TopAppBar.stories.tsx index 9877f3b7..b24baa4a 100644 --- a/Storybook/components/TopAppBar/TopAppBar.stories.tsx +++ b/Storybook/components/TopAppBar/TopAppBar.stories.tsx @@ -12,6 +12,7 @@ import TopAppBarMenuItem from '../../../src/components/topAppBar/Menu/TopAppBarM import type { Title } from 'src/components/topAppBar/TopAppBar'; import { TopAppBarMenuProvider } from '../../../src/components/topAppBar/Menu/TopAppMenuBarContext'; import { IconName } from '../../../src/components/icons/IconProps'; +import TopAppBarMenuAction from '../../../src/components/topAppBar/Menu/TopAppBarMenuAction'; const asString = { value: 'menu' }; const asButton = { value: 'menu', onPress: () => {} }; @@ -109,7 +110,7 @@ export const WithMenuAction = (args) => { ); }} > - + } /> @@ -125,7 +126,13 @@ export const WithCloseAction = (args) => { size={args.size} onBack={args.withBackButton ? args.onBack : undefined} title={titleComponent} - action={} + action={ + + } /> ); }; @@ -141,7 +148,9 @@ export const WithPrinterSettingsAction = (args) => { onBack={args.withBackButton ? args.onBack : undefined} title={titleComponent} action={ - } diff --git a/src/__tests__/components/TopAppBar.test.tsx b/src/__tests__/components/TopAppBar.test.tsx index 343006f1..2dba24bc 100644 --- a/src/__tests__/components/TopAppBar.test.tsx +++ b/src/__tests__/components/TopAppBar.test.tsx @@ -10,7 +10,8 @@ import { import { Text } from 'react-native'; import TopAppBarMenuItem from '../../components/topAppBar/Menu/TopAppBarMenuItem'; import { TopAppBarMenuProvider } from '../../components/topAppBar/Menu/TopAppMenuBarContext'; -import { IconName } from 'src/components/icons/IconProps'; +import { IconName } from '../../components/icons/IconProps'; +import TopAppBarMenuAction from '../../components/topAppBar/Menu/TopAppBarMenuAction'; const topBarTitle = 'Menu'; @@ -100,7 +101,7 @@ describe('TopAppBar mounting with a menu', () => { ); }} > - + } />, diff --git a/src/components/topAppBar/Actions/TopAppBarCloseAction.tsx b/src/components/topAppBar/Actions/TopAppBarCloseAction.tsx deleted file mode 100644 index e6702409..00000000 --- a/src/components/topAppBar/Actions/TopAppBarCloseAction.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import React, { ComponentProps } from 'react'; -import TopAppBarAction from './TopAppBarAction'; - -type TopAppBarCloseActionProps = Omit< - ComponentProps, - 'icon' ->; - -const TopAppBarCloseAction = (props: TopAppBarCloseActionProps) => { - return ; -}; - -export default TopAppBarCloseAction; diff --git a/src/components/topAppBar/Actions/TopAppBarPrinterSettingsAction.tsx b/src/components/topAppBar/Actions/TopAppBarPrinterSettingsAction.tsx deleted file mode 100644 index 7f3c7aa6..00000000 --- a/src/components/topAppBar/Actions/TopAppBarPrinterSettingsAction.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React, { ComponentProps } from 'react'; -import TopAppBarAction from './TopAppBarAction'; - -type TopAppBarPrinterSettingsActionProps = Omit< - ComponentProps, - 'icon' ->; - -const TopAppBarPrinterSettingsAction = ( - props: TopAppBarPrinterSettingsActionProps, -) => { - return ; -}; - -export default TopAppBarPrinterSettingsAction; diff --git a/src/components/topAppBar/Actions/TopAppBarMenuAction.tsx b/src/components/topAppBar/Menu/TopAppBarMenuAction.tsx similarity index 73% rename from src/components/topAppBar/Actions/TopAppBarMenuAction.tsx rename to src/components/topAppBar/Menu/TopAppBarMenuAction.tsx index 53305751..b9591c0f 100644 --- a/src/components/topAppBar/Actions/TopAppBarMenuAction.tsx +++ b/src/components/topAppBar/Menu/TopAppBarMenuAction.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { useTopBarMenu } from '../Menu/TopAppMenuBarContext'; -import TopAppBarAction from './TopAppBarAction'; +import { useTopBarMenu } from './TopAppMenuBarContext'; +import TopAppBarAction from '../TopAppBarAction'; const TopAppBarMenuAction = () => { const { showMenu } = useTopBarMenu(); diff --git a/src/components/topAppBar/Menu/TopAppMenuBarContext.tsx b/src/components/topAppBar/Menu/TopAppMenuBarContext.tsx index 821b25d8..c8f0bda5 100644 --- a/src/components/topAppBar/Menu/TopAppMenuBarContext.tsx +++ b/src/components/topAppBar/Menu/TopAppMenuBarContext.tsx @@ -1,8 +1,7 @@ -import React, { ComponentProps, ReactNode } from 'react'; +import React, { ReactNode } from 'react'; import { StyleSheet, View } from 'react-native'; import { Menu, Modal, Portal } from 'react-native-paper'; import { useTheme } from '../../../styles/themes'; -import TopAppBarMenuItem from './TopAppBarMenuItem'; type TopAppBarMenuContextValue = | { @@ -11,11 +10,9 @@ type TopAppBarMenuContextValue = } | undefined; -type MenuItemId = ComponentProps['id']; - type MenuItem = ExtendedMenuItem & { title: string; - id: MenuItemId; + id: string; }; const TopAppBarMenuContext = diff --git a/src/components/topAppBar/TopAppBar.tsx b/src/components/topAppBar/TopAppBar.tsx index ed99aa2e..e58d68b0 100644 --- a/src/components/topAppBar/TopAppBar.tsx +++ b/src/components/topAppBar/TopAppBar.tsx @@ -5,9 +5,7 @@ import { StyleSheet, type ViewStyle } from 'react-native'; import { Headline } from '../typography/Headline'; import DeviceInfo from 'react-native-device-info'; import type { WithTestID } from 'src/shared/type'; -import TopAppBarCloseAction from './Actions/TopAppBarCloseAction'; -import TopAppBarMenuAction from './Actions/TopAppBarMenuAction'; -import TopAppBarPrinterSettingsAction from './Actions/TopAppBarPrinterSettingsAction'; +import TopAppBarAction from './TopAppBarAction'; export interface Title { value: ReactNode; @@ -64,9 +62,7 @@ export function TopAppBar({ ); } -TopAppBar.CloseAction = TopAppBarCloseAction; -TopAppBar.MenuAction = TopAppBarMenuAction; -TopAppBar.PrinterSettingsAction = TopAppBarPrinterSettingsAction; +TopAppBar.Action = TopAppBarAction; function useStyles( size: TopAppBarProps['size'], diff --git a/src/components/topAppBar/Actions/TopAppBarAction.tsx b/src/components/topAppBar/TopAppBarAction.tsx similarity index 94% rename from src/components/topAppBar/Actions/TopAppBarAction.tsx rename to src/components/topAppBar/TopAppBarAction.tsx index be1926e6..19fa1985 100644 --- a/src/components/topAppBar/Actions/TopAppBarAction.tsx +++ b/src/components/topAppBar/TopAppBarAction.tsx @@ -1,6 +1,6 @@ import React, { ComponentProps } from 'react'; import { Appbar } from 'react-native-paper'; -import { Theme, useTheme } from '../../../styles/themes'; +import { Theme, useTheme } from '../../styles/themes'; import DeviceInfo from 'react-native-device-info'; import { StyleSheet } from 'react-native';