Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/src/nav-tabs/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const DxcTab = forwardRef(
<Tab
href={!disabled && href ? href : undefined}
disabled={disabled}
active={active}
iconPosition={iconPosition}
hasIcon={hasIcons}
ref={(anchorRef) => {
Expand Down Expand Up @@ -112,6 +113,7 @@ const TabContainer = styled.div<TabContainerProps>`
type TabStyleProps = {
disabled: boolean;
hasIcon: boolean;
active?: boolean;
iconPosition: "top" | "left";
};
const Tab = styled.a<TabStyleProps>`
Expand All @@ -122,7 +124,8 @@ const Tab = styled.a<TabStyleProps>`

text-decoration-color: transparent;
cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
background: ${(props) => props.theme.selectedBackgroundColor};
background: ${(props) =>
props.active ? props.theme.selectedBackgroundColor : props.theme.unselectedBackgroundColor};

height: ${(props) => (props.hasIcon && props.iconPosition === "top" ? "66px" : "32px")};
min-width: 164px;
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint": "next lint"
},
"dependencies": {
"@dxc-technology/halstack-react": "0.0.0-a5b9b2c",
"@dxc-technology/halstack-react": "0.0.0-dcee34a",
"@radix-ui/react-popover": "0.1.6",
"@types/styled-components": "^5.1.18",
"axios": "^0.27.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import FooterPreview from "./previews/Footer";
import HeaderPreview from "./previews/Header";
import BulletedListPreview from "./previews/BulletedList";
import ParagraphPreview from "./previews/Paragraph";
import NavTabsPreview from "./previews/NavTabs";

const SampleComponents = [
{
Expand Down Expand Up @@ -97,6 +98,10 @@ const SampleComponents = [
name: "link",
preview: LinkPreview,
},
{
name: "navTabs",
preview: NavTabsPreview,
},
{
name: "textarea",
preview: TextareaPreview,
Expand Down
46 changes: 46 additions & 0 deletions website/screens/theme-generator/components/previews/NavTabs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from "react";
import { DxcNavTabs } from "@dxc-technology/halstack-react";
import Mode from "../Mode";
import PreviewContainer from "./PreviewContainer";

const iconSVG = (
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M0 0h24v24H0z" fill="none" />
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
</svg>
);

const NavTabs = () => (
<PreviewContainer>
<Mode text="Default">
<DxcNavTabs>
<DxcNavTabs.Tab href="#" active>
Tab 1
</DxcNavTabs.Tab>
<DxcNavTabs.Tab href="#" disabled>
Tab 2
</DxcNavTabs.Tab>
<DxcNavTabs.Tab href="#">Tab 3</DxcNavTabs.Tab>
<DxcNavTabs.Tab href="#">Tab 4</DxcNavTabs.Tab>
</DxcNavTabs>
</Mode>
<Mode text="With icon and notification">
<DxcNavTabs iconPosition="left">
<DxcNavTabs.Tab href="#" active icon={iconSVG} notificationNumber>
Tab 1
</DxcNavTabs.Tab>
<DxcNavTabs.Tab href="#" disabled icon={iconSVG} notificationNumber={5}>
Tab 2
</DxcNavTabs.Tab>
<DxcNavTabs.Tab href="#" icon={iconSVG} notificationNumber={120}>
Tab 3
</DxcNavTabs.Tab>
<DxcNavTabs.Tab href="#" icon={iconSVG}>
Tab 4
</DxcNavTabs.Tab>
</DxcNavTabs>
</Mode>
</PreviewContainer>
);

export default NavTabs;