Skip to content

Commit

Permalink
Swap Fleet Server tabs to EuiButtonGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
kpollich committed May 16, 2022
1 parent b1473f8 commit babe0dd
Showing 1 changed file with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@

import React, { useState } from 'react';
import {
EuiButtonGroup,
EuiFlexGroup,
EuiFlyout,
EuiFlyoutBody,
EuiFlyoutHeader,
EuiLink,
EuiSpacer,
EuiTab,
EuiTabs,
EuiText,
EuiTitle,
} from '@elastic/eui';
Expand All @@ -41,14 +40,16 @@ const useFleetServerTabs = () => {

const quickStartTab = {
id: 'quickStart',
name: 'Quick Start',
label: 'Quick Start',
content: <QuickStartTab />,
'data-test-subj': 'fleetServerFlyoutTab-quickStart',
};

const advancedTab = {
id: 'advanced',
name: 'Advanced',
label: 'Advanced',
content: <AdvancedTab />,
'data-test-subj': 'fleetServerFlyoutTab-advancedStart',
};

const currentTabContent =
Expand All @@ -60,7 +61,7 @@ const useFleetServerTabs = () => {
const Header: React.FunctionComponent<{
isFlyout?: boolean;
currentTab: string;
tabs: Array<{ id: string; name: string; content: React.ReactNode }>;
tabs: Array<{ id: string; label: string; content: React.ReactNode }>;
onTabClick: (id: string) => void;
}> = ({ isFlyout = false, currentTab: currentTabId, tabs, onTabClick }) => {
const { docLinks } = useStartServices();
Expand Down Expand Up @@ -99,21 +100,18 @@ const Header: React.FunctionComponent<{
/>
</EuiText>

<EuiSpacer size="m" />

<EuiTabs style={{ marginBottom: isFlyout ? '-25px' : '' }}>
{tabs.map((tab) => (
<EuiTab
key={`fleetServerFlyoutTab-${tab.id}`}
data-test-subj={`fleetServerFlyoutTab-${tab.id}`}
id={tab.id}
isSelected={tab.id === currentTabId}
onClick={() => onTabClick(tab.id)}
>
{tab.name}
</EuiTab>
))}
</EuiTabs>
<EuiSpacer size="xl" />

<EuiButtonGroup
legend="Fleet Server instructions"
isFullWidth
options={tabs}
idSelected={currentTabId}
onChange={(id) => onTabClick(id)}
css={`
max-width: 500px;
`}
/>
</>
);
};
Expand Down

0 comments on commit babe0dd

Please sign in to comment.