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

feat(component): replaced SideNavHeader.js -> SideNavHeader.tsx component #15120

Merged
merged 2 commits into from
Nov 14, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,32 @@ import React from 'react';
import SideNavIcon from './SideNavIcon';
import { usePrefix } from '../../internal/usePrefix';

const SideNavHeader = ({
className: customClassName,
interface SideNavHeaderProps {
/**
* The child nodes to be rendered
*/
children?: React.ReactNode;

/**
* Provide an optional class to be applied to the containing node
*/
className?: string;

/**
* Property to indicate if the side nav container is open (or not). Use to
* keep local state and styling in step with the SideNav expansion state.
*/
isSideNavExpanded?: boolean;

/**
* Provide an icon to render in the header of the side navigation. Should be
* a React class.
*/
renderIcon: React.ComponentType;
}
const SideNavHeader: React.FC<SideNavHeaderProps> = ({
children,
className: customClassName,
renderIcon: IconElement,
}) => {
const prefix = usePrefix();
Expand Down Expand Up @@ -49,6 +72,7 @@ SideNavHeader.propTypes = {
* Provide an icon to render in the header of the side navigation. Should be
* a React class.
*/
// @ts-expect-error - PropTypes are unable to cover this case.
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
.isRequired,
};
Expand Down