Skip to content

Commit e9be8b8

Browse files
authored
[todo] Fix cancel button (#1575)
1 parent 2476946 commit e9be8b8

File tree

7 files changed

+38
-37
lines changed

7 files changed

+38
-37
lines changed

packages/mgt-components/src/components/mgt-tasks-base/mgt-tasks-base.scss

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ $task-border-completed: var(--task-complete-border, 2px dotted inherit);
3232
-webkit-appearance: none;
3333
}
3434

35-
3635
.TaskIcon {
3736
font-family: 'FabricMDL2Icons';
3837
user-select: none;
@@ -517,6 +516,8 @@ $task-border-completed: var(--task-complete-border, 2px dotted inherit);
517516

518517
.TaskTitle {
519518
display: flex;
519+
height: 32px;
520+
padding: 2px;
520521

521522
input {
522523
flex: 1;
@@ -582,9 +583,6 @@ $task-border-completed: var(--task-complete-border, 2px dotted inherit);
582583
font-weight: 600;
583584
border: var(--task-new-select-border, none);
584585
border-bottom: 1px solid $ms-color-gray40;
585-
outline: none;
586-
border-radius: 0;
587-
padding: 4px;
588586

589587
&:hover {
590588
border-bottom: 1px solid $ms-color-communicationShade10;
@@ -603,36 +601,39 @@ $task-border-completed: var(--task-complete-border, 2px dotted inherit);
603601
}
604602

605603
.TaskAddButtonContainer {
606-
flex: 0 0 auto;
607-
display: flex;
604+
margin-right: 28px;
608605

609606
.TaskAdd,
610607
.TaskCancel {
611-
height: 100%;
612-
max-width: 50px;
613-
min-width: 50px;
614-
flex: 1 1 auto;
615608
justify-content: center;
616609
align-items: center;
617-
display: flex;
618610
cursor: pointer;
611+
flex: 0 0 auto;
612+
display: flex;
613+
width: var(--tasks-new-button-width, 100px);
614+
height: var(--tasks-new-button-height, 32px);
615+
border-radius: 4px;
616+
border: var(--tasks-new-button-border, solid 1px #e5e5e5);
617+
font-family: var(--default-font-family, 'Segoe UI');
618+
font-size: 14px;
619+
line-height: 20px;
620+
// margin: 0 12px 0 32px;
619621
}
620622

621623
.TaskAdd {
622624
color: white;
623625
background: var(--task-new-add-button-background, $ms-color-communicationPrimary);
626+
margin: 22px 0 12px auto;
627+
// margin: 22px 12px 8px 32px;
624628
}
625629

626630
.TaskCancel {
627-
font-family: var(--default-font-family, 'Segoe UI');
628-
font-size: 14px;
629-
font-weight: 600;
630631
color: $button__color--cancel;
631-
margin: 0 12px 0 32px;
632632
}
633633

634634
&.Disabled .TaskAdd {
635-
background: var(--task-new-add-button-disabled-background, #eaeaea);
635+
color: $button__color--cancel;
636+
background: var(--task-new-add-button-disabled-background, #ffffff);
636637
cursor: default;
637638
}
638639
}

packages/mgt-components/src/components/mgt-tasks-base/mgt-tasks-base.theme.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ $detail__color: var(--task-detail-color, set-var(color__sub2, $theme-default, $c
1616
$tasks: (
1717
border: (
1818
_var: --task-border,
19-
light: 2px solid $background-color__sub3--light,
20-
dark: 2px solid $background-color__sub3--dark
19+
light: 1px solid $background-color__sub3--light,
20+
dark: 1px solid $background-color__sub3--dark
2121
),
2222
border--completed: (
2323
_var: --task-complete-border,

packages/mgt-components/src/components/mgt-tasks-base/mgt-tasks-base.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,16 @@ export abstract class MgtTasksBase extends MgtTemplatedComponent {
244244
});
245245
const taskAddTemplate = !this._isNewTaskBeingAdded
246246
? html`
247+
<div
248+
tabindex='0'
249+
class="TaskIcon TaskAdd"
250+
@click="${() => this.addTask()}"
251+
@keypress="${(e: KeyboardEvent) => {
252+
if (e.key === 'Enter' || e.key === ' ') this.addTask();
253+
}}"
254+
>
255+
<span>${this.strings.addTaskButtonSubtitle}</span>
256+
</div>
247257
<div
248258
role='button'
249259
tabindex='0'
@@ -254,16 +264,6 @@ export abstract class MgtTasksBase extends MgtTemplatedComponent {
254264
}}">
255265
<span>${this.strings.cancelNewTaskSubtitle}</span>
256266
</div>
257-
<div
258-
tabindex='0'
259-
class="TaskIcon TaskAdd"
260-
@click="${() => this.addTask()}"
261-
@keypress="${(e: KeyboardEvent) => {
262-
if (e.key === 'Enter' || e.key === ' ') this.addTask();
263-
}}"
264-
>
265-
<span></span>
266-
</div>
267267
`
268268
: null;
269269

packages/mgt-components/src/components/mgt-tasks-base/strings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* -------------------------------------------------------------------------------------------
66
*/
77
export const strings = {
8-
cancelNewTaskSubtitle: 'cancel',
9-
newTaskPlaceholder: 'Task...',
8+
cancelNewTaskSubtitle: 'Cancel',
9+
newTaskPlaceholder: 'Adding task...',
1010
addTaskButtonSubtitle: 'Add',
1111
removeTaskSubtitle: 'Delete Task'
1212
};

packages/mgt-components/src/components/mgt-tasks/mgt-tasks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,12 +1009,12 @@ export class MgtTasks extends MgtTemplatedComponent {
10091009
`
10101010
: html`
10111011
<div class="TaskAddButtonContainer ${this._newTaskName === '' ? 'Disabled' : ''}">
1012+
<div class="TaskIcon TaskAdd" @click="${this.onAddTaskClick}">
1013+
<span>${this.strings.addTaskButtonSubtitle}</span>
1014+
</div>
10121015
<div class="TaskIcon TaskCancel" @click="${() => (this.isNewTaskVisible = false)}">
10131016
<span>${this.strings.cancelNewTaskSubtitle}</span>
10141017
</div>
1015-
<div class="TaskIcon TaskAdd" @click="${this.onAddTaskClick}">
1016-
<span></span>
1017-
</div>
10181018
</div>
10191019
`;
10201020

packages/mgt-components/src/components/mgt-tasks/strings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
export const strings = {
88
removeTaskSubtitle: 'Delete Task',
9-
cancelNewTaskSubtitle: 'cancel',
10-
newTaskPlaceholder: 'Task...',
9+
cancelNewTaskSubtitle: 'Cancel',
10+
newTaskPlaceholder: 'Adding task...',
1111
addTaskButtonSubtitle: 'Add'
1212
};

packages/mgt-components/src/components/mgt-todo/strings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
*/
1414

1515
export const strings = {
16-
cancelNewTaskSubtitle: 'cancel',
17-
newTaskPlaceholder: 'Task...',
16+
cancelNewTaskSubtitle: 'Cancel',
17+
newTaskPlaceholder: 'Adding task...',
1818
addTaskButtonSubtitle: 'Add',
1919
removeTaskSubtitle: 'Delete Task'
2020
};

0 commit comments

Comments
 (0)