Skip to content

Commit

Permalink
Add and integrate controls story
Browse files Browse the repository at this point in the history
  • Loading branch information
jonniebigodes committed Dec 22, 2023
1 parent 3f59dc0 commit d648b74
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 6 deletions.
72 changes: 66 additions & 6 deletions documentation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@
},
{
"name": "TaskComponent",
"id": "component-TaskComponent-97e67216388f4f33c654981dd1f14e55f5fca030a99e54bbe279c5c22aa00d64a3dce75b75ae08b2e5fd0de78368795e04a32a7c291e67feb2fb0426b07a6547",
"id": "component-TaskComponent-dd93d72efc99edf5426977bb9b920166bdba9253eeb1f46a1151888d6ce49017045185d4074675aabe79eef91ea4d0d94c72e7a5a92a955794ac6a3296594acc",
"file": "src/app/components/task.component.ts",
"encapsulation": [],
"entryComponents": [],
Expand All @@ -1127,7 +1127,7 @@
"selector": "app-task",
"styleUrls": [],
"styles": [],
"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",
"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",
"templateUrl": [],
"viewProviders": [],
"hostDirectives": [],
Expand All @@ -1138,7 +1138,7 @@
"deprecationMessage": "",
"rawdescription": "\n\nThe shape of the task object\n",
"description": "<p>The shape of the task object</p>\n",
"line": 51,
"line": 52,
"type": "Task",
"decorators": []
}
Expand All @@ -1149,15 +1149,15 @@
"defaultValue": "new EventEmitter<Event>()",
"deprecated": false,
"deprecationMessage": "",
"line": 59,
"line": 60,
"type": "EventEmitter"
},
{
"name": "onPinTask",
"defaultValue": "new EventEmitter<Event>()",
"deprecated": false,
"deprecationMessage": "",
"line": 55,
"line": 56,
"type": "EventEmitter"
}
],
Expand All @@ -1172,7 +1172,7 @@
"description": "",
"rawdescription": "\n",
"type": "component",
"sourceCode": "import { Component, Input, Output, EventEmitter } from '@angular/core';\nimport { Task } from '../models/task.model';\n\n@Component({\n selector: 'app-task',\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",
"sourceCode": "import { Component, Input, Output, EventEmitter } from '@angular/core';\nimport { Task } from '../models/task.model';\n\n@Component({\n selector: 'app-task',\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",
"assetsDirs": [],
"styleUrlsData": "",
"stylesData": "",
Expand Down Expand Up @@ -1592,6 +1592,26 @@
"type": "Story",
"defaultValue": "{\n render: (args: Page) => ({\n props: args,\n }),\n}"
},
{
"name": "LongTitle",
"ctype": "miscellaneous",
"subtype": "variable",
"file": "src/app/components/task.stories.ts",
"deprecated": false,
"deprecationMessage": "",
"type": "Story",
"defaultValue": "{\n args: {\n task: {\n ...Default.args?.task,\n title: longTitleString,\n },\n },\n}"
},
{
"name": "longTitleString",
"ctype": "miscellaneous",
"subtype": "variable",
"file": "src/app/components/task.stories.ts",
"deprecated": false,
"deprecationMessage": "",
"type": "",
"defaultValue": "`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!`"
},
{
"name": "meta",
"ctype": "miscellaneous",
Expand Down Expand Up @@ -1847,6 +1867,26 @@
"type": "Story",
"defaultValue": "{\n args: {\n task: {\n id: '1',\n title: 'Test Task',\n state: 'TASK_INBOX',\n },\n },\n}"
},
{
"name": "LongTitle",
"ctype": "miscellaneous",
"subtype": "variable",
"file": "src/app/components/task.stories.ts",
"deprecated": false,
"deprecationMessage": "",
"type": "Story",
"defaultValue": "{\n args: {\n task: {\n ...Default.args?.task,\n title: longTitleString,\n },\n },\n}"
},
{
"name": "longTitleString",
"ctype": "miscellaneous",
"subtype": "variable",
"file": "src/app/components/task.stories.ts",
"deprecated": false,
"deprecationMessage": "",
"type": "",
"defaultValue": "`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!`"
},
{
"name": "meta",
"ctype": "miscellaneous",
Expand Down Expand Up @@ -2387,6 +2427,26 @@
"coverageCount": "0/1",
"status": "low"
},
{
"filePath": "src/app/components/task.stories.ts",
"type": "variable",
"linktype": "miscellaneous",
"linksubtype": "variable",
"name": "LongTitle",
"coveragePercent": 0,
"coverageCount": "0/1",
"status": "low"
},
{
"filePath": "src/app/components/task.stories.ts",
"type": "variable",
"linktype": "miscellaneous",
"linksubtype": "variable",
"name": "longTitleString",
"coveragePercent": 0,
"coverageCount": "0/1",
"status": "low"
},
{
"filePath": "src/app/components/task.stories.ts",
"type": "variable",
Expand Down
1 change: 1 addition & 0 deletions src/app/components/task.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { Task } from '../models/task.model';
id="title-{{ task?.id }}"
name="title-{{ task?.id }}"
placeholder="Input title"
style="text-overflow: ellipsis;"
/>
</label>
<button
Expand Down
11 changes: 11 additions & 0 deletions src/app/components/task.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,14 @@ export const Archived: Story = {
},
},
};

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!`;

export const LongTitle: Story = {
args: {
task: {
...Default.args?.task,
title: longTitleString,
},
},
};

0 comments on commit d648b74

Please sign in to comment.