-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
109 changed files
with
6,002 additions
and
4,064 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.08 KB
packages/ui/.loki/reference/chrome_minimal_App_Header_Disabled_Select_Cluster.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.53 KB
packages/ui/.loki/reference/chrome_minimal_App_Header_Without_Menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.36 KB
packages/ui/.loki/reference/chrome_minimal_App_Header_Without_Select_Cluster.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.21 KB
packages/ui/.loki/reference/chrome_minimal_App_Sidebar_Collapsed_With_Scroll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.2 KB
packages/ui/.loki/reference/chrome_minimal_App_Sidebar_With_Scroll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.65 KB
(110%)
packages/ui/.loki/reference/chrome_minimal_Components_Button_Active.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.11 KB
(100%)
packages/ui/.loki/reference/chrome_minimal_Components_Button_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.81 KB
(120%)
packages/ui/.loki/reference/chrome_minimal_Components_Button_Disabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.49 KB
(110%)
...i/.loki/reference/chrome_minimal_Components_Button_Disabled_With_Long_Label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.49 KB
(110%)
...minimal_Components_Button_Disabled_With_Long_Label_Showing_Label_In_Tooltip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+5.51 KB
(110%)
packages/ui/.loki/reference/chrome_minimal_Components_Button_Focused.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.71 KB
(110%)
packages/ui/.loki/reference/chrome_minimal_Components_Button_Hovered.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-329 Bytes
(94%)
packages/ui/.loki/reference/chrome_minimal_Components_Button_Link_Semantics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.47 KB
(100%)
packages/ui/.loki/reference/chrome_minimal_Components_Button_Non_Capitalized.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.11 KB
(100%)
...ages/ui/.loki/reference/chrome_minimal_Components_Button_With_Inset_Outline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.44 KB
(110%)
.../.loki/reference/chrome_minimal_Components_Button_With_Left_And_Right_Icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.32 KB
(100%)
packages/ui/.loki/reference/chrome_minimal_Components_Button_With_Left_Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.12 KB
(110%)
packages/ui/.loki/reference/chrome_minimal_Components_Button_With_Loader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.81 KB
(110%)
....loki/reference/chrome_minimal_Components_Button_With_Loader_And_Both_Icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.12 KB
(110%)
.../.loki/reference/chrome_minimal_Components_Button_With_Loader_And_Left_Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.06 KB
(110%)
....loki/reference/chrome_minimal_Components_Button_With_Loader_And_Right_Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.45 KB
(110%)
packages/ui/.loki/reference/chrome_minimal_Components_Button_With_Long_Label.png
Oops, something went wrong.
Binary file modified
BIN
+1.46 KB
(100%)
packages/ui/.loki/reference/chrome_minimal_Components_Button_With_Right_Icon.png
Oops, something went wrong.
Binary file modified
BIN
+2.75 KB
(130%)
...ges/ui/.loki/reference/chrome_minimal_Components_Tooltip_Auto_End_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.78 KB
(130%)
packages/ui/.loki/reference/chrome_minimal_Components_Tooltip_Auto_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.75 KB
(130%)
...s/ui/.loki/reference/chrome_minimal_Components_Tooltip_Auto_Start_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.7 KB
(130%)
...s/ui/.loki/reference/chrome_minimal_Components_Tooltip_Bottom_End_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.67 KB
(130%)
packages/ui/.loki/reference/chrome_minimal_Components_Tooltip_Bottom_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.67 KB
(130%)
...ui/.loki/reference/chrome_minimal_Components_Tooltip_Bottom_Start_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+538 Bytes
(110%)
packages/ui/.loki/reference/chrome_minimal_Components_Tooltip_Disabled.png
Oops, something went wrong.
Binary file modified
BIN
+538 Bytes
(110%)
packages/ui/.loki/reference/chrome_minimal_Components_Tooltip_Invisible.png
Oops, something went wrong.
Binary file modified
BIN
+2.76 KB
(130%)
...ges/ui/.loki/reference/chrome_minimal_Components_Tooltip_Left_End_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.65 KB
(130%)
packages/ui/.loki/reference/chrome_minimal_Components_Tooltip_Left_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.76 KB
(130%)
...s/ui/.loki/reference/chrome_minimal_Components_Tooltip_Left_Start_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.19 KB
(130%)
...es/ui/.loki/reference/chrome_minimal_Components_Tooltip_Right_End_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.12 KB
(130%)
packages/ui/.loki/reference/chrome_minimal_Components_Tooltip_Right_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.24 KB
(130%)
.../ui/.loki/reference/chrome_minimal_Components_Tooltip_Right_Start_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.66 KB
(130%)
...ages/ui/.loki/reference/chrome_minimal_Components_Tooltip_Top_End_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.65 KB
(130%)
packages/ui/.loki/reference/chrome_minimal_Components_Tooltip_Top_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.64 KB
(130%)
...es/ui/.loki/reference/chrome_minimal_Components_Tooltip_Top_Start_Placement.png
Oops, something went wrong.
Binary file modified
BIN
+2.78 KB
(130%)
packages/ui/.loki/reference/chrome_minimal_Components_Tooltip_Visible.png
Oops, something went wrong.
Binary file modified
BIN
+17.1 KB
(170%)
.../.loki/reference/chrome_minimal_Components_Tooltip_With_Interactive_Content.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import React, { useState } from 'react' | ||
|
||
import { Button } from '../src/Button' | ||
import { AppHeader as AppHeaderComponent } from '../src/AppHeader' | ||
|
||
export default { | ||
title: 'App/Header', | ||
component: AppHeaderComponent, | ||
} | ||
|
||
export const Default = () => { | ||
const [cluster, setCluster] = useState<string | null>(null) | ||
|
||
return ( | ||
<AppHeaderComponent | ||
name="Management Center" | ||
logoProps={{ | ||
LinkComponent: ({ children, className }) => <span className={className}>{children}</span>, | ||
}} | ||
clusterSelectProps={{ | ||
clusterName: cluster, | ||
clusterNames: ['Cluster-1', 'Cluster-2'], | ||
clusterVersions: { 'Cluster-1': '5.5', 'Cluster-2': '6.0', 'Cluster-3': '3.1.2' }, | ||
onChange: setCluster, | ||
}} | ||
menuContent={() => ( | ||
<> | ||
<span>Item</span> | ||
</> | ||
)} | ||
/> | ||
) | ||
} | ||
|
||
export const WithBadge = () => { | ||
const [cluster, setCluster] = useState<string | null>(null) | ||
|
||
return ( | ||
<AppHeaderComponent | ||
name="Management Center" | ||
clusterSelectProps={{ | ||
clusterName: cluster, | ||
clusterNames: ['Cluster-1', 'Cluster-2'], | ||
clusterVersions: { 'Cluster-1': '5.5', 'Cluster-2': '6.0', 'Cluster-3': '3.1.2' }, | ||
onChange: setCluster, | ||
}} | ||
menuContent={() => ( | ||
<> | ||
<Button color="light" variant="text"> | ||
Item 1 | ||
</Button> | ||
</> | ||
)} | ||
environment="production" | ||
logoProps={{ | ||
LinkComponent: ({ children, className }) => <span className={className}>{children}</span>, | ||
}} | ||
/> | ||
) | ||
} | ||
|
||
export const WithoutSelectCluster = () => ( | ||
<AppHeaderComponent | ||
name="Management Center" | ||
logoProps={{ | ||
LinkComponent: ({ children, className }) => <span className={className}>{children}</span>, | ||
}} | ||
menuContent={() => ( | ||
<> | ||
<Button color="light" variant="text"> | ||
Item 1 | ||
</Button> | ||
</> | ||
)} | ||
/> | ||
) | ||
|
||
export const DisabledSelectCluster = () => { | ||
const [cluster, setCluster] = useState<string | null>(null) | ||
|
||
return ( | ||
<AppHeaderComponent | ||
name="Management Center" | ||
clusterSelectProps={{ | ||
clusterNames: [], | ||
clusterName: cluster, | ||
onChange: setCluster, | ||
}} | ||
logoProps={{ | ||
LinkComponent: ({ children, className }) => <span className={className}>{children}</span>, | ||
}} | ||
menuContent={() => ( | ||
<> | ||
<Button color="light" variant="text"> | ||
Item 1 | ||
</Button> | ||
</> | ||
)} | ||
/> | ||
) | ||
} | ||
|
||
export const WithoutMenu = () => { | ||
const [cluster, setCluster] = useState<string | null>(null) | ||
|
||
return ( | ||
<AppHeaderComponent | ||
name="Management Center" | ||
clusterSelectProps={{ | ||
clusterName: cluster, | ||
clusterNames: ['Cluster-1', 'Cluster-2'], | ||
clusterVersions: { 'Cluster-1': '5.5', 'Cluster-2': '6.0', 'Cluster-3': '3.1.2' }, | ||
onChange: setCluster, | ||
}} | ||
logoProps={{ | ||
LinkComponent: ({ children, className }) => <span className={className}>{children}</span>, | ||
}} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React from 'react' | ||
import { Story } from '@storybook/react' | ||
import { Disc, HardDrive, Wifi, Activity, Droplet, Airplay } from 'react-feather' | ||
|
||
import { | ||
AppSidebar, | ||
AppSidebarSection, | ||
AppSidebarMenuItemCounter, | ||
AppSidebarItem, | ||
AppSidebarProps, | ||
AppSidebarFavorites, | ||
} from '../src/AppSidebar' | ||
|
||
export default { | ||
title: 'App/Sidebar', | ||
component: AppSidebar, | ||
} | ||
|
||
const Template: Story<Partial<AppSidebarProps>> = (props) => ( | ||
<AppSidebar footer={<span>24/08/14 01:49 PM Ver. 5.5.0</span>} {...props}> | ||
<AppSidebarFavorites>{({ items }) => items.map((item) => <AppSidebarItem key={item} id={item} title={item} />)}</AppSidebarFavorites> | ||
<AppSidebarSection active id="maps" title="Maps wan replication" ariaLabel="maps" icon={Disc}> | ||
<AppSidebarItem id="1" title="Test" active wrapper={({ children }) => <a href="/">{children}</a>} /> | ||
<AppSidebarItem title="Wan healthcheck replication" /> | ||
<AppSidebarItem title="Test 2" /> | ||
</AppSidebarSection> | ||
<AppSidebarSection active={false} id="cluster" title="Cluster" ariaLabel="cluster" icon={HardDrive}> | ||
<AppSidebarItem id="2" title="Cluster-1" adornment={<AppSidebarMenuItemCounter>13</AppSidebarMenuItemCounter>} /> | ||
<AppSidebarItem title="Cluster-2" adornment={<AppSidebarMenuItemCounter>3</AppSidebarMenuItemCounter>} /> | ||
</AppSidebarSection> | ||
<AppSidebarSection active={false} id="members" title="Memebers" ariaLabel="memebers" icon={Wifi}> | ||
<AppSidebarItem title="Cluster-1" adornment={<AppSidebarMenuItemCounter>13</AppSidebarMenuItemCounter>} /> | ||
<AppSidebarItem title="Cluster-2" adornment={<AppSidebarMenuItemCounter>3</AppSidebarMenuItemCounter>} /> | ||
</AppSidebarSection> | ||
<AppSidebarSection active={false} id="storage" title="Storage" ariaLabel="storage" icon={Activity}> | ||
<AppSidebarItem title="Cluster-1" adornment={<AppSidebarMenuItemCounter>13</AppSidebarMenuItemCounter>} /> | ||
</AppSidebarSection> | ||
<AppSidebarSection title="TOOLS"> | ||
<AppSidebarItem title="SQL" icon={Airplay} iconAriaLabel="SQL" onClick={console.log} /> | ||
<AppSidebarItem title="Flow" color="authPrimary" icon={Droplet} iconAriaLabel="Flow" available={false} onClick={console.log} /> | ||
</AppSidebarSection> | ||
</AppSidebar> | ||
) | ||
|
||
export const Default = () => <Template open /> | ||
|
||
export const WithScroll = () => { | ||
return ( | ||
<div style={{ height: 200, overflow: 'hidden' }}> | ||
<Template open /> | ||
</div> | ||
) | ||
} | ||
|
||
export const Collapsed = () => <Template open={false} /> | ||
|
||
export const CollapsedWithScroll = () => { | ||
return ( | ||
<div style={{ height: 200, overflow: 'hidden' }}> | ||
<Template open={false} /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, { ComponentType } from 'react' | ||
import { act } from 'react-dom/test-utils' | ||
import { userEvent } from '@testing-library/user-event' | ||
import { screen, render } from '@testing-library/react' | ||
import { DataTestProp } from '@hazelcast/helpers' | ||
|
||
import { AppHeader } from '../../src/AppHeader' | ||
|
||
const LinkComponent: ComponentType<DataTestProp> = ({ children, 'data-test': dataTest }) => <div data-test={dataTest}>{children}</div> | ||
|
||
describe('AppHeader', () => { | ||
it('renders basic version', () => { | ||
render(<AppHeader name="Test App" logoProps={{ LinkComponent }} />) | ||
|
||
expect(screen.queryByText('Test App')).toBeInTheDocument() | ||
expect(screen.queryByTestId('logo-link')).toBeInTheDocument() | ||
expect(screen.queryByTestId('environment-badge')).not.toBeInTheDocument() | ||
expect(screen.queryByTestId('select-cluster')).not.toBeInTheDocument() | ||
expect(screen.queryByTestId('app-header-menu-toggle')).not.toBeInTheDocument() | ||
}) | ||
|
||
it('renders menu content', async () => { | ||
render(<AppHeader name="Test App" logoProps={{ LinkComponent }} menuContent={() => <span>Menu content</span>} />) | ||
|
||
expect(screen.queryByTestId('app-header-menu-toggle')).toBeInTheDocument() | ||
expect(screen.queryByText('Menu content')).not.toBeInTheDocument() | ||
|
||
await act(async () => { | ||
await userEvent.click(screen.getByTestId('app-header-menu-toggle')) | ||
}) | ||
|
||
expect(screen.queryByText('Menu content')).toBeInTheDocument() | ||
}) | ||
|
||
it('renders select cluster', () => { | ||
render( | ||
<AppHeader | ||
name="Test App" | ||
logoProps={{ LinkComponent }} | ||
clusterSelectProps={{ | ||
clusterName: 'Cluster-1', | ||
clusterNames: ['Cluster-1', 'Cluster-2'], | ||
clusterVersions: { 'Cluster-1': '5.5', 'Cluster-2': '6.0', 'Cluster-3': '3.1.2' }, | ||
onChange: jest.fn(), | ||
}} | ||
/>, | ||
) | ||
|
||
expect(screen.queryByTestId('select-cluster')).toBeInTheDocument() | ||
}) | ||
}) |
Oops, something went wrong.