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

[Emotion] Convert EuiSideNav #7521

Merged
merged 19 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Make all style-related props pass correctly to EuiSideNavItem
doesn't need a changelog as this is not a publicly exported component
  • Loading branch information
cee-chen committed Feb 9, 2024
commit fa184498e58cc2839cad17dab14f311b5dd1e729
5 changes: 4 additions & 1 deletion src/components/side_nav/side_nav_item.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
*/

import React from 'react';
import { requiredProps } from '../../test/required_props';
import { render } from '../../test/rtl';
import { shouldRenderCustomStyles } from '../../test/internal';
import { requiredProps } from '../../test/required_props';

import { EuiSideNavItem } from './side_nav_item';

describe('EuiSideNavItem', () => {
shouldRenderCustomStyles(<EuiSideNavItem>test</EuiSideNavItem>);

test('is rendered', () => {
const { container } = render(
<EuiSideNavItem>
Expand Down
10 changes: 9 additions & 1 deletion src/components/side_nav/side_nav_item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import React, {
HTMLAttributes,
ReactNode,
ReactElement,
MouseEventHandler,
Expand Down Expand Up @@ -75,6 +76,10 @@ export interface _EuiSideNavItemProps {
* Passed to the actual `.euiSideNavItemButton` element
*/
buttonClassName?: string;
/**
* className, css, and style are passed to the parent wrapper, not the button
*/
style?: HTMLAttributes<HTMLDivElement>['style'];
// Exposed as different prop type to consumer
items?: ReactNode;
// Not exposed to consumer
Expand Down Expand Up @@ -165,6 +170,8 @@ export const EuiSideNavItem = <
renderItem: RenderItem = DefaultRenderItem,
depth = 0,
className,
css,
style,
truncate = true,
emphasize,
buttonClassName,
Expand Down Expand Up @@ -210,6 +217,7 @@ export const EuiSideNavItem = <
isTrunk && styles.trunk,
isBranch && styles.branch,
emphasize && styles.emphasized,
css,
];
const itemsStyles = hasChildItems && [
styles.items.euiSideNavItem__items,
Expand Down Expand Up @@ -241,7 +249,7 @@ export const EuiSideNavItem = <
];

return (
<div css={cssStyles} className={classes}>
<div css={cssStyles} className={classes} style={style}>
<RenderItem
css={buttonCssStyles}
className={buttonClasses}
Expand Down