Skip to content

Commit f6d3d1c

Browse files
committed
Add and integrate controls story
1 parent 359daa2 commit f6d3d1c

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

documentation.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@
11271127
},
11281128
{
11291129
"name": "TaskComponent",
1130-
"id": "component-TaskComponent-5ad01db1f5390cce6295783d548ba485e2cbd8a3e885901dcd7f0019c93df17b55ac355e1726e046b59c46650eea5eb0c4df9fe54631549647590d546f705a2f",
1130+
"id": "component-TaskComponent-27e9b77a853ba8cbf13113b4edd12979e71bc2ad43fd44c406eb5b4a648ae8ca190eacb0160d717ea02565e80cb4ee779d33558f425e42c294b5d90ecb19a8dd",
11311131
"file": "src/app/components/task.component.ts",
11321132
"encapsulation": [],
11331133
"entryComponents": [],
@@ -1137,7 +1137,7 @@
11371137
"selector": "app-task",
11381138
"styleUrls": [],
11391139
"styles": [],
1140-
"template": "<div class=\"list-item {{ task?.state }}\">\n <label\n [attr.aria-label]=\"'archiveTask-' + task?.id\"\n for=\"checked-{{ task?.id }}\"\n class=\"checkbox\"\n >\n <input\n type=\"checkbox\"\n disabled=\"true\"\n [defaultChecked]=\"task?.state === 'TASK_ARCHIVED'\"\n name=\"checked-{{ task?.id }}\"\n id=\"checked-{{ task?.id }}\"\n />\n <span class=\"checkbox-custom\" (click)=\"onArchive(task?.id)\"></span>\n </label>\n <label\n [attr.aria-label]=\"task?.title + ''\"\n for=\"title-{{ task?.id }}\"\n class=\"title\"\n >\n <input\n type=\"text\"\n [value]=\"task?.title\"\n readonly=\"true\"\n id=\"title-{{ task?.id }}\"\n name=\"title-{{ task?.id }}\"\n placeholder=\"Input title\"\n />\n </label>\n <button\n *ngIf=\"task?.state !== 'TASK_ARCHIVED'\"\n class=\"pin-button\"\n [attr.aria-label]=\"'pinTask-' + task?.id\"\n (click)=\"onPin(task?.id)\"\n >\n <span class=\"icon-star\"></span>\n </button>\n</div>\n",
1140+
"template": "<div class=\"list-item {{ task?.state }}\">\n <label\n [attr.aria-label]=\"'archiveTask-' + task?.id\"\n for=\"checked-{{ task?.id }}\"\n class=\"checkbox\"\n >\n <input\n type=\"checkbox\"\n disabled=\"true\"\n [defaultChecked]=\"task?.state === 'TASK_ARCHIVED'\"\n name=\"checked-{{ task?.id }}\"\n id=\"checked-{{ task?.id }}\"\n />\n <span class=\"checkbox-custom\" (click)=\"onArchive(task?.id)\"></span>\n </label>\n <label\n [attr.aria-label]=\"task?.title + ''\"\n for=\"title-{{ task?.id }}\"\n class=\"title\"\n >\n <input\n type=\"text\"\n [value]=\"task?.title\"\n readonly=\"true\"\n id=\"title-{{ task?.id }}\"\n name=\"title-{{ task?.id }}\"\n placeholder=\"Input title\"\n style=\"text-overflow: ellipsis;\"\n />\n </label>\n <button\n *ngIf=\"task?.state !== 'TASK_ARCHIVED'\"\n class=\"pin-button\"\n [attr.aria-label]=\"'pinTask-' + task?.id\"\n (click)=\"onPin(task?.id)\"\n >\n <span class=\"icon-star\"></span>\n </button>\n</div>\n",
11411141
"templateUrl": [],
11421142
"viewProviders": [],
11431143
"hostDirectives": [],
@@ -1148,7 +1148,7 @@
11481148
"deprecationMessage": "",
11491149
"rawdescription": "\n\nThe shape of the task object\n",
11501150
"description": "<p>The shape of the task object</p>\n",
1151-
"line": 52,
1151+
"line": 53,
11521152
"type": "Task",
11531153
"decorators": []
11541154
}
@@ -1159,15 +1159,15 @@
11591159
"defaultValue": "new EventEmitter<Event>()",
11601160
"deprecated": false,
11611161
"deprecationMessage": "",
1162-
"line": 60,
1162+
"line": 61,
11631163
"type": "EventEmitter"
11641164
},
11651165
{
11661166
"name": "onPinTask",
11671167
"defaultValue": "new EventEmitter<Event>()",
11681168
"deprecated": false,
11691169
"deprecationMessage": "",
1170-
"line": 56,
1170+
"line": 57,
11711171
"type": "EventEmitter"
11721172
}
11731173
],
@@ -1182,7 +1182,7 @@
11821182
"description": "",
11831183
"rawdescription": "\n",
11841184
"type": "component",
1185-
"sourceCode": "import { Component, Input, Output, EventEmitter } from '@angular/core';\nimport { Task } from '../models/task.model';\n\n@Component({\n selector: 'app-task',\n standalone: false,\n template: `\n <div class=\"list-item {{ task?.state }}\">\n <label\n [attr.aria-label]=\"'archiveTask-' + task?.id\"\n for=\"checked-{{ task?.id }}\"\n class=\"checkbox\"\n >\n <input\n type=\"checkbox\"\n disabled=\"true\"\n [defaultChecked]=\"task?.state === 'TASK_ARCHIVED'\"\n name=\"checked-{{ task?.id }}\"\n id=\"checked-{{ task?.id }}\"\n />\n <span class=\"checkbox-custom\" (click)=\"onArchive(task?.id)\"></span>\n </label>\n <label\n [attr.aria-label]=\"task?.title + ''\"\n for=\"title-{{ task?.id }}\"\n class=\"title\"\n >\n <input\n type=\"text\"\n [value]=\"task?.title\"\n readonly=\"true\"\n id=\"title-{{ task?.id }}\"\n name=\"title-{{ task?.id }}\"\n placeholder=\"Input title\"\n />\n </label>\n <button\n *ngIf=\"task?.state !== 'TASK_ARCHIVED'\"\n class=\"pin-button\"\n [attr.aria-label]=\"'pinTask-' + task?.id\"\n (click)=\"onPin(task?.id)\"\n >\n <span class=\"icon-star\"></span>\n </button>\n </div>\n `,\n})\nexport default class TaskComponent {\n /**\n * The shape of the task object\n */\n @Input() task?: Task;\n\n // tslint:disable-next-line: no-output-on-prefix\n @Output()\n onPinTask = new EventEmitter<Event>();\n\n // tslint:disable-next-line: no-output-on-prefix\n @Output()\n onArchiveTask = new EventEmitter<Event>();\n\n /**\n * @ignore\n * Component method to trigger the onPin event\n * @param id string\n */\n onPin(id: any) {\n this.onPinTask.emit(id);\n }\n /**\n * @ignore\n * Component method to trigger the onArchive event\n * @param id string\n */\n onArchive(id: any) {\n this.onArchiveTask.emit(id);\n }\n}\n",
1185+
"sourceCode": "import { Component, Input, Output, EventEmitter } from '@angular/core';\nimport { Task } from '../models/task.model';\n\n@Component({\n selector: 'app-task',\n standalone: false,\n template: `\n <div class=\"list-item {{ task?.state }}\">\n <label\n [attr.aria-label]=\"'archiveTask-' + task?.id\"\n for=\"checked-{{ task?.id }}\"\n class=\"checkbox\"\n >\n <input\n type=\"checkbox\"\n disabled=\"true\"\n [defaultChecked]=\"task?.state === 'TASK_ARCHIVED'\"\n name=\"checked-{{ task?.id }}\"\n id=\"checked-{{ task?.id }}\"\n />\n <span class=\"checkbox-custom\" (click)=\"onArchive(task?.id)\"></span>\n </label>\n <label\n [attr.aria-label]=\"task?.title + ''\"\n for=\"title-{{ task?.id }}\"\n class=\"title\"\n >\n <input\n type=\"text\"\n [value]=\"task?.title\"\n readonly=\"true\"\n id=\"title-{{ task?.id }}\"\n name=\"title-{{ task?.id }}\"\n placeholder=\"Input title\"\n style=\"text-overflow: ellipsis;\"\n />\n </label>\n <button\n *ngIf=\"task?.state !== 'TASK_ARCHIVED'\"\n class=\"pin-button\"\n [attr.aria-label]=\"'pinTask-' + task?.id\"\n (click)=\"onPin(task?.id)\"\n >\n <span class=\"icon-star\"></span>\n </button>\n </div>\n `,\n})\nexport default class TaskComponent {\n /**\n * The shape of the task object\n */\n @Input() task?: Task;\n\n // tslint:disable-next-line: no-output-on-prefix\n @Output()\n onPinTask = new EventEmitter<Event>();\n\n // tslint:disable-next-line: no-output-on-prefix\n @Output()\n onArchiveTask = new EventEmitter<Event>();\n\n /**\n * @ignore\n * Component method to trigger the onPin event\n * @param id string\n */\n onPin(id: any) {\n this.onPinTask.emit(id);\n }\n /**\n * @ignore\n * Component method to trigger the onArchive event\n * @param id string\n */\n onArchive(id: any) {\n this.onArchiveTask.emit(id);\n }\n}\n",
11861186
"assetsDirs": [],
11871187
"styleUrlsData": "",
11881188
"stylesData": "",

src/app/components/task.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { Task } from '../models/task.model';
3232
id="title-{{ task?.id }}"
3333
name="title-{{ task?.id }}"
3434
placeholder="Input title"
35+
style="text-overflow: ellipsis;"
3536
/>
3637
</label>
3738
<button

src/app/components/task.stories.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,14 @@ export const Archived: Story = {
5050
},
5151
},
5252
};
53+
54+
const longTitleString = `This task's name is absurdly large. In fact, I think if I keep going I might end up with content overflow. What will happen? The star that represents a pinned task could have text overlapping. The text could cut-off abruptly when it reaches the star. I hope not!`;
55+
56+
export const LongTitle: Story = {
57+
args: {
58+
task: {
59+
...Default.args?.task,
60+
title: longTitleString,
61+
},
62+
},
63+
};

0 commit comments

Comments
 (0)