Skip to content

Commit c2e78cf

Browse files
committed
feat(styles): add support for custom className and style props in DualScrollSyncNavItem component
1 parent bd7e649 commit c2e78cf

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

lib/components/DualScrollSync/DualScrollSyncNavItem/DualScrollSyncNavItem.test.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,21 @@ describe('DualScrollSyncNavItem', () => {
5454
expect(navItem).toBeInTheDocument();
5555
expect(getByText('Custom Child')).toBeInTheDocument();
5656
});
57+
58+
it('should apply custom className and style', () => {
59+
const { getByTestId } = render(
60+
<DualScrollSyncNavItem
61+
sectionKey="custom"
62+
className="custom-class"
63+
style={{ borderWidth: '1px' }}
64+
>
65+
<div>Styled Content</div>
66+
</DualScrollSyncNavItem>
67+
);
68+
69+
const navItem = getByTestId('test-nav-id-item-custom');
70+
71+
expect(navItem).toHaveClass('custom-class');
72+
expect(navItem).toHaveStyle('border-width: 1px');
73+
});
5774
});

lib/components/DualScrollSync/DualScrollSyncNavItem/DualScrollSyncNavItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import styles from './DualScrollSyncNavItem.module.scss';
77
import type { DualScrollSyncNavItemProps } from './DualScrollSyncNavItem.types';
88

99
export const DualScrollSyncNavItem: FC<DualScrollSyncNavItemProps> = ({
10-
sectionKey,
1110
children,
1211
className,
13-
style
12+
sectionKey,
13+
style = {}
1414
}) => {
1515
const { navId, onMenuItemSelect, onItemClick, activeKey, navItemRefs } =
1616
useDualScrollSyncContext();

0 commit comments

Comments
 (0)