Skip to content

Commit 598f8a5

Browse files
committed
refactor: . move layout helper functions to a separate file
1 parent 7b669fb commit 598f8a5

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/Layout/LayoutHelpers.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export function generateHiddenClassForTaskList(taskListHiddenClasses: string[], hide: boolean, component: string) {
2+
if (hide) {
3+
taskListHiddenClasses.push(hiddenComponentClassName(component));
4+
}
5+
}
6+
7+
function hiddenComponentClassName(component: string) {
8+
return `tasks-layout-hide-${component}`;
9+
}

src/Layout/TaskLayout.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { TaskLayoutOptions } from './TaskLayoutOptions';
1+
import { generateHiddenClassForTaskList } from './LayoutHelpers';
22
import { QueryLayoutOptions } from './QueryLayoutOptions';
3+
import { TaskLayoutOptions } from './TaskLayoutOptions';
34

45
export type TaskLayoutComponent =
56
// NEW_TASK_FIELD_EDIT_REQUIRED
@@ -67,16 +68,6 @@ export class QueryLayout {
6768
}
6869
}
6970

70-
function generateHiddenClassForTaskList(taskListHiddenClasses: string[], hide: boolean, component: string) {
71-
if (hide) {
72-
taskListHiddenClasses.push(hiddenComponentClassName(component));
73-
}
74-
}
75-
76-
function hiddenComponentClassName(component: string) {
77-
return `tasks-layout-hide-${component}`;
78-
}
79-
8071
/**
8172
* This represents the desired layout of tasks when they are rendered in a given configuration.
8273
* The layout is used when flattening the task to a string and when rendering queries, and can be

0 commit comments

Comments
 (0)