From 21135b7763969ff2394f55b695d44677553d3eae Mon Sep 17 00:00:00 2001 From: Sophie Schneider Date: Fri, 22 Mar 2024 19:50:45 +0000 Subject: [PATCH] Change ThemeProvider story to TopBar component --- .../ThemeProvider/ThemeProvider.stories.tsx | 261 +++++------------- 1 file changed, 62 insertions(+), 199 deletions(-) diff --git a/polaris-react/src/components/ThemeProvider/ThemeProvider.stories.tsx b/polaris-react/src/components/ThemeProvider/ThemeProvider.stories.tsx index d4484030b27..01ad02d1748 100644 --- a/polaris-react/src/components/ThemeProvider/ThemeProvider.stories.tsx +++ b/polaris-react/src/components/ThemeProvider/ThemeProvider.stories.tsx @@ -1,222 +1,85 @@ -import React, {useState} from 'react'; +import React, {useCallback, useState} from 'react'; import type {ComponentMeta} from '@storybook/react'; import { - Button, + Frame, + Icon, + TopBar, Text, ThemeProvider, - Card, - Popover, - ActionList, - useBreakpoints, + InlineStack, } from '@shopify/polaris'; -import { - ClipboardIcon, - DeleteIcon, - ExportIcon, - ImportIcon, - MenuHorizontalIcon, -} from '@shopify/polaris-icons'; +import {SidekickIcon, NotificationIcon} from '@shopify/polaris-icons'; export default { component: ThemeProvider, } as ComponentMeta; -const sections = [ - { - title: 'File options', - items: [ - { - active: true, - content: 'Import file', - icon: ImportIcon, - }, - {content: 'Export file', icon: ExportIcon}, - { - destructive: true, - content: 'Delete file', - icon: DeleteIcon, - }, - ], - }, -]; - export function Default() { - const breakpoints = useBreakpoints(); - - const [lightThemeLightPopoverActive, setLightThemeLightPopoverActive] = - useState(false); + const [isSidekickMenuOpen, setIsSidekickMenuOpen] = useState(true); - const [darkThemeDarkPopoverActive, setDarkThemeDarkPopoverActive] = - useState(false); + const toggleIsSidekickMenuOpen = useCallback( + () => setIsSidekickMenuOpen((isSidekickMenuOpen) => !isSidekickMenuOpen), + [], + ); - const [lightThemeDarkPopoverActive, setLightThemeDarkPopoverActive] = - useState(false); + const [isNotificationsMenuOpen, setIsNotificationsMenuOpen] = useState(false); - const [darkThemeLightPopoverActive, setDarkThemeLightPopoverActive] = - useState(false); + const toggleIsNotificationsMenuOpen = useCallback( + () => + setIsNotificationsMenuOpen( + (isNotificationsMenuOpen) => !isNotificationsMenuOpen, + ), + [], + ); - return ( -
- setLightThemeLightPopoverActive((active) => !active)} - activator={ -
+ + ); + + const notificationsMenu = ( + + } + open={isNotificationsMenuOpen} + onOpen={toggleIsNotificationsMenuOpen} + onClose={toggleIsNotificationsMenuOpen} + actions={[ + { + items: [{content: 'Dark theme popover'}], + }, + ]} + /> + ); -} -function CustomerCard(props: {moreActions: React.ReactNode}) { return ( - -
-
- - Customer - - {props.moreActions} - - John Smith - -
-
- - Contact Information! - -
-
- - Address - -
- - 1234 Street -
- Anytown, CA, 12345 -
-
-
- + + {sidekickMenu} + {notificationsMenu} + + } + /> + } + /> ); }