Skip to content

Commit

Permalink
Refactor #4293
Browse files Browse the repository at this point in the history
  • Loading branch information
ulasturann committed May 5, 2023
1 parent b1dc8bb commit 8c12ecc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
10 changes: 4 additions & 6 deletions components/lib/accordion/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const Accordion = React.forwardRef((inProps, ref) => {
const elementRef = React.useRef(null);
const activeIndex = props.onTabChange ? props.activeIndex : activeIndexState;

const parentProps = {
const metaData = {
props,
state: {
id: idState,
Expand All @@ -26,15 +26,13 @@ export const Accordion = React.forwardRef((inProps, ref) => {
};

const { ptm, ptmo } = AccordionBase.setMetaData({
...parentProps
...metaData
});

const getTabPT = (tab, key) => {
return ptmo(getTabProp(tab, 'pt'), key, {
props: tab.props,
parent: {
...parentProps
}
parent: metaData
});
};

Expand Down Expand Up @@ -174,7 +172,7 @@ export const Accordion = React.forwardRef((inProps, ref) => {
{
className: 'p-accordion-content'
},
getTabPT(tab, 'toggleablecontent')
getTabPT(tab, 'content')
);

return (
Expand Down
2 changes: 1 addition & 1 deletion components/lib/card/card.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface CardPassThroughOptions {
/**
* Uses to pass attributes to the subtitle's DOM element.
*/
subtitle?: CardPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
subTitle?: CardPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
/**
* Uses to pass attributes to the content's DOM element.
*/
Expand Down
12 changes: 5 additions & 7 deletions components/lib/tabview/TabView.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const TabView = React.forwardRef((inProps, ref) => {
const tabsRef = React.useRef({});
const activeIndex = props.onTabChange ? props.activeIndex : activeIndexState;

const parentProps = {
const metaData = {
props,
state: {
id: idState,
Expand All @@ -39,15 +39,13 @@ export const TabView = React.forwardRef((inProps, ref) => {
};

const { ptm, ptmo } = TabViewBase.setMetaData({
...parentProps
...metaData
});

const getTabPT = (tab, key) => {
return ptmo(getTabProp(tab, 'pt'), key, {
props: tab.props,
parent: {
...parentProps
}
parent: metaData
});
};

Expand Down Expand Up @@ -343,9 +341,9 @@ export const TabView = React.forwardRef((inProps, ref) => {
style,
role: 'tabpanel',
'aria-labelledby': ariaLabelledBy,
'aria-hidden': !selected,
...TabPanelBase.getCOtherProps(tab)
'aria-hidden': !selected
},
TabPanelBase.getCOtherProps(tab),
getTabPT(tab, 'root'),
getTabPT(tab, 'content')
);
Expand Down
16 changes: 8 additions & 8 deletions components/lib/tabview/tabview.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ export interface TabViewPassThroughOptions {
/**
* Uses to pass attributes to the nav container's DOM element.
*/
navcontainer?: TabViewPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
navContainer?: TabViewPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
/**
* Uses to pass attributes to the nav content's DOM element.
*/
navcontent?: TabViewPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
navContent?: TabViewPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
/**
* Uses to pass attributes to the list's DOM element.
*/
Expand All @@ -289,23 +289,23 @@ export interface TabViewPassThroughOptions {
/**
* Uses to pass attributes to the previous button's DOM element.
*/
prevbutton?: TabViewPassThroughType<React.HTMLAttributes<HTMLButtonElement>>;
previousButton?: TabViewPassThroughType<React.HTMLAttributes<HTMLButtonElement>>;
/**
* Uses to pass attributes to the previous button icon's DOM element.
*/
previcon?: TabViewPassThroughType<React.HTMLAttributes<HTMLSpanElement | SVGSVGElement>>;
previousIcon?: TabViewPassThroughType<React.HTMLAttributes<HTMLSpanElement | SVGSVGElement>>;
/**
* Uses to pass attributes to the nex button's DOM element.
* Uses to pass attributes to the next button's DOM element.
*/
nextbutton?: TabViewPassThroughType<React.HTMLAttributes<HTMLButtonElement>>;
nextButton?: TabViewPassThroughType<React.HTMLAttributes<HTMLButtonElement>>;
/**
* Uses to pass attributes to the next button icon's DOM element.
*/
nexticon?: TabViewPassThroughType<React.HTMLAttributes<HTMLSpanElement | SVGSVGElement>>;
nextIcon?: TabViewPassThroughType<React.HTMLAttributes<HTMLSpanElement | SVGSVGElement>>;
/**
* Uses to pass attributes to the panel's DOM element.
*/
panelcontainer?: TabViewPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
panelContainer?: TabViewPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
}

/**
Expand Down

0 comments on commit 8c12ecc

Please sign in to comment.