Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisione componente Tab #1129

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"@types/jest": "^29.5.12",
"@types/node": "^20.12.2",
"@types/react": "^18.2.75",
"@types/react-bootstrap": "^0.32.37",
"@types/react-dom": "^18.2.24",
"@types/react-transition-group": "^4.4.10",
"bootstrap-italia": "2.12.1",
Expand Down Expand Up @@ -135,6 +136,7 @@
"dependencies": {
"classnames": "^2.3.1",
"is-number": "^7.0.0",
"react-bootstrap": "^2.10.6",
"react-stickup": "^1.12.1",
"react-toastify": "^7.0.4",
"react-transition-group": "^4.4.5",
Expand Down
19 changes: 19 additions & 0 deletions src/Tab/TabNav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import classNames from 'classnames';
import React, { ElementType, FC } from 'react';
import { Nav, NavProps } from 'react-bootstrap';

export interface TabNavProps extends NavProps {
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
tag?: ElementType;
/** Classi aggiuntive da usare per il componente Tab */
className?: string;
testId?: string;
}

export const TabNav: FC<TabNavProps> = ({ className, tag = 'ul', testId, ...attributes }) => {
const Tag = tag;

const classes = classNames(className, 'nav-tabs');

return <Nav as={Tag} className={classes} data-testid={testId} {...attributes}></Nav>;
};
14 changes: 14 additions & 0 deletions src/Tab/TabNavItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React, { ElementType, FC } from 'react';
import { Nav, NavItemProps } from 'react-bootstrap';

export interface TabNavItemProps extends NavItemProps {
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
tag?: ElementType;
testId?: string;
}

export const TabNavItem: FC<TabNavItemProps> = ({ tag = 'li', testId, ...attributes }) => {
const Tag = tag;

return <Nav.Item as={Tag} role='presentation' data-testid={testId} {...attributes}></Nav.Item>;
};
14 changes: 14 additions & 0 deletions src/Tab/TabNavLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React, { ElementType, FC } from 'react';
import { Nav, NavLinkProps } from 'react-bootstrap';

export interface TabNavLinkProps extends NavLinkProps {
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
tag?: ElementType;
testId?: string;
}

export const TabNavLink: FC<TabNavLinkProps> = ({ tag, testId, ...attributes }) => {
const Tag = tag;

return <Nav.Link as={Tag} data-testid={testId} {...attributes}></Nav.Link>;
};
14 changes: 14 additions & 0 deletions src/Tab/TabPanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React, { ElementType, FC } from 'react';
import { NavProps, Tab } from 'react-bootstrap';

export interface TabsProps extends NavProps {
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
tag?: ElementType;
testId?: string;
}

export const TabContainer: FC<TabsProps> = ({ tag, testId, ...attributes }) => {
const Tag = tag;

return <Tab.Container as={Tag} data-testid={testId} {...attributes}></Tab.Container>;
};
14 changes: 9 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ export {
PopoverBody,
PopoverHeader,
Row,
TabContent,
TabPane,
Table,
Tooltip,
UncontrolledAlert,
Expand All @@ -47,6 +45,7 @@ export {
Util
} from 'reactstrap';

export { TabContainer, TabContent, TabPane } from 'react-bootstrap';
export { Autocomplete } from './Autocomplete/Autocomplete';
export { Accordion } from './Accordion/Accordion';
export { AccordionBody } from './Accordion/AccordionBody';
Expand Down Expand Up @@ -136,6 +135,9 @@ export { StepperDots } from './Stepper/StepperDots';
export { StepperHeader } from './Stepper/StepperHeader';
export { StepperHeaderElement } from './Stepper/StepperHeaderElement';
export { StepperNav } from './Stepper/StepperNav';
export { TabNav } from './Tab/TabNav';
export { TabNavItem } from './Tab/TabNavItem';
export { TabNavLink } from './Tab/TabNavLink';
export { ThumbNav } from './ThumbNav/ThumbNav';
export { ThumbNavItem } from './ThumbNav/ThumbNavItem';
export { TimelinePin } from './Timeline/TimelinePin';
Expand Down Expand Up @@ -242,6 +244,9 @@ export type { StepperDotsProps } from './Stepper/StepperDots';
export type { StepperHeaderProps } from './Stepper/StepperHeader';
export type { StepperHeaderElementProps } from './Stepper/StepperHeaderElement';
export type { StepperNavProps } from './Stepper/StepperNav';
export type { TabNavProps } from './Tab/TabNav';
export type { TabNavItemProps } from './Tab/TabNavItem';
export type { TabNavLinkProps } from './Tab/TabNavLink';
export type { ThumbNavProps } from './ThumbNav/ThumbNav';
export type { ThumbNavItemProps } from './ThumbNav/ThumbNavItem';
export type { TimelinePinProps } from './Timeline/TimelinePin';
Expand Down Expand Up @@ -290,13 +295,12 @@ export type {
PopoverHeaderProps,
PopoverProps,
RowProps,
TabContentProps,
TabPaneProps,
TableProps,
TooltipProps,
UncontrolledAlertProps,
UncontrolledCollapseProps,
UncontrolledTooltipProps
} from 'reactstrap';

import "./track-focus.js"
export type { TabContainerProps, TabContentProps, TabPaneProps } from 'react-bootstrap';
import "./track-focus.js"
Loading
Loading