Skip to content

Commit fc0a8bd

Browse files
committed
make optional initialLengths parameter
1 parent 403c030 commit fc0a8bd

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

ethernet-view/src/hooks/useSplit/useSplit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export type SplitElement = {
3131
* @returns The `useSplit` function returns an array containing the `elements` state and the
3232
* `handleMouseDown` function from the `separatorEventHandler`.
3333
*/
34-
export function useSplit(initialLengths: number[] | undefined, minLengths: number[], direction: Orientation) {
34+
export function useSplit(minLengths: number[], direction: Orientation, initialLengths?: number[]) {
3535

3636
if(!initialLengths || initialLengths.length != minLengths.length || initialLengths.reduce((prev, curr) => prev + curr, 0) != 1) {
3737
initialLengths = minLengths.map(() => 1 / minLengths.length);

ethernet-view/src/layouts/SplitLayout/SplitLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type Props = {
1717
export const SplitLayout = ({ initialLengths, components, orientation = Orientation.HORIZONTAL }: Props) => {
1818

1919
const minLengths = components.map(() => 0.05);
20-
const [splitElements, onSeparatorMouseDown] = useSplit(initialLengths, minLengths, orientation);
20+
const [splitElements, onSeparatorMouseDown] = useSplit(minLengths, orientation, initialLengths);
2121

2222
return (
2323
<div

0 commit comments

Comments
 (0)