Skip to content

Commit

Permalink
[TimelineRow]: Replace defaultProps with destructuring
Browse files Browse the repository at this point in the history
Partially Resolves jaegertracing#2596
- Remove defaultProps from the TimelineRow component, replace with destructuring

Signed-off-by: Abhishek <[email protected]>
  • Loading branch information
its-me-abhishek committed Jan 24, 2025
1 parent 2d880b4 commit 25ac5de
Showing 1 changed file with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,29 @@ import * as React from 'react';

import './TimelineRow.css';

type TTimelineRowProps = {
export default function TimelineRow({ children, className = '', ...rest }: {
children: React.ReactNode;
className?: string;
};

interface ITimelineRowCellProps extends React.HTMLAttributes<HTMLDivElement> {
children: React.ReactNode;
className?: string;
width: number;
style?: object;
}

export default function TimelineRow(props: TTimelineRowProps) {
const { children, className = '', ...rest } = props;
}) {
return (
<div className={`flex-row ${className}`} {...rest}>
{children}
</div>
);
}

TimelineRow.defaultProps = {
className: '',
};

function TimelineRowCell(props: ITimelineRowCellProps) {
const { children, className = '', width, style, ...rest } = props;
function TimelineRowCell({
children,
className = '',
width,
style = {},
...rest
}: {
children: React.ReactNode;
className?: string;
width: number;
style?: object;
}) {
const widthPercent = `${width * 100}%`;
const mergedStyle = { ...style, flexBasis: widthPercent, maxWidth: widthPercent };
return (
Expand All @@ -52,6 +48,4 @@ function TimelineRowCell(props: ITimelineRowCellProps) {
);
}

TimelineRowCell.defaultProps = { className: '', style: {} };

TimelineRow.Cell = TimelineRowCell;

0 comments on commit 25ac5de

Please sign in to comment.