mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-24 08:28:12 +00:00
fix(web): Only display assertion tab buttons if there is more than one button (#13678)
This commit is contained in:
parent
b6ae134a56
commit
f1f6fd9fa9
@ -55,21 +55,25 @@ export const AssertionTabs = ({ defaultSelectedTab, tabs }: Props) => {
|
||||
const [selectedTab, setSelectedTab] = useState<string>(defaultSelectedTab);
|
||||
return (
|
||||
<>
|
||||
<Tabs>
|
||||
{tabs.map((tab) => (
|
||||
<Tooltip title={tab.tooltip} placement="bottom" showArrow={false}>
|
||||
<TabButton
|
||||
selected={selectedTab === tab.key}
|
||||
disabled={tab.disabled}
|
||||
key={tab.key}
|
||||
onClick={() => (!tab.disabled ? setSelectedTab(tab.key) : null)}
|
||||
>
|
||||
{tab.label}
|
||||
</TabButton>
|
||||
</Tooltip>
|
||||
))}
|
||||
</Tabs>
|
||||
<StyledDivider />
|
||||
{tabs.length > 1 && (
|
||||
<>
|
||||
<Tabs>
|
||||
{tabs.map((tab) => (
|
||||
<Tooltip title={tab.tooltip} placement="bottom" showArrow={false}>
|
||||
<TabButton
|
||||
selected={selectedTab === tab.key}
|
||||
disabled={tab.disabled}
|
||||
key={tab.key}
|
||||
onClick={() => (!tab.disabled ? setSelectedTab(tab.key) : null)}
|
||||
>
|
||||
{tab.label}
|
||||
</TabButton>
|
||||
</Tooltip>
|
||||
))}
|
||||
</Tabs>
|
||||
<StyledDivider />
|
||||
</>
|
||||
)}
|
||||
<TabContent>{tabs.find((tab) => tab.key === selectedTab)?.content}</TabContent>
|
||||
</>
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user