Skip to content

Commit dce05bb

Browse files
committed
refactor: . extract createFieldWithoutDataAttributes()
1 parent 15b0cdc commit dce05bb

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/Renderer/TaskFieldRenderer.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Moment } from 'moment';
2+
import type { TaskLayoutComponent } from '../Layout/TaskLayout';
23
import { PriorityTools } from '../lib/PriorityTools';
34
import type { Task } from '../Task/Task';
4-
import type { TaskLayoutComponent } from '../Layout/TaskLayout';
55

66
export class TaskFieldRenderer {
77
private readonly data = taskFieldHTMLData;
@@ -139,6 +139,14 @@ export class TaskFieldHTMLData {
139139
}
140140
}
141141

142+
function createFieldWithoutDataAttributes(className: string) {
143+
return new TaskFieldHTMLData(
144+
className,
145+
TaskFieldHTMLData.noAttributeName,
146+
TaskFieldHTMLData.noAttributeValueCalculator,
147+
);
148+
}
149+
142150
const taskFieldHTMLData: { [c in TaskLayoutComponent]: TaskFieldHTMLData } = {
143151
// NEW_TASK_FIELD_EDIT_REQUIRED
144152
createdDate: new TaskFieldHTMLData('task-created', 'taskCreated', TaskFieldHTMLData.dateAttributeCalculator),
@@ -148,11 +156,7 @@ const taskFieldHTMLData: { [c in TaskLayoutComponent]: TaskFieldHTMLData } = {
148156
doneDate: new TaskFieldHTMLData('task-done', 'taskDone', TaskFieldHTMLData.dateAttributeCalculator),
149157
cancelledDate: new TaskFieldHTMLData('task-cancelled', 'taskCancelled', TaskFieldHTMLData.dateAttributeCalculator),
150158

151-
description: new TaskFieldHTMLData(
152-
'task-description',
153-
TaskFieldHTMLData.noAttributeName,
154-
TaskFieldHTMLData.noAttributeValueCalculator,
155-
),
159+
description: createFieldWithoutDataAttributes('task-description'),
156160
recurrenceRule: new TaskFieldHTMLData(
157161
'task-recurring',
158162
TaskFieldHTMLData.noAttributeName,

0 commit comments

Comments
 (0)