Skip to content

Commit 8276a29

Browse files
feat: add example for static assets
1 parent 31ab41c commit 8276a29

File tree

4 files changed

+9
-23
lines changed

4 files changed

+9
-23
lines changed

.storybook/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const config: StorybookConfig = {
1212
options: {},
1313
},
1414
docs: {},
15+
staticDirs: ["../public"]
1516
};
1617

1718
export default config;

documentation.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
},
9090
{
9191
"name": "ButtonComponent",
92-
"id": "component-ButtonComponent-86e2311c54fbca7431c12e070d0fd5b0ebe343eec0553a392f182ba0e04a8f86613233d26ee47718fd0e7a65078f580c76a1fcc928ce55de81193d6618025bc4",
92+
"id": "component-ButtonComponent-ea53b5a9b3579bbf02b4f897c0f411e26ae8b2dd9c9c1e5b8217b126a54713d3f22e6f6f3fd6841aa3a7142c4050d331406abeb0c3671b6eb723895455e85bb7",
9393
"file": "src/stories/button.component.ts",
9494
"encapsulation": [],
9595
"entryComponents": [],
@@ -101,7 +101,7 @@
101101
"./button.css"
102102
],
103103
"styles": [],
104-
"template": "<button type=\"button\"\n (click)=\"onClick.emit($event)\"\n [ngClass]=\"classes\"\n [ngStyle]=\"{ 'background-color': backgroundColor }\"\n >\n {{ label }}\n </button>",
104+
"template": "<img src=\"/angular-gradient.png\"/> <button type=\"button\"\n (click)=\"onClick.emit($event)\"\n [ngClass]=\"classes\"\n [ngStyle]=\"{ 'background-color': backgroundColor }\"\n >\n {{ label }}\n </button>",
105105
"templateUrl": [],
106106
"viewProviders": [],
107107
"hostDirectives": [],
@@ -123,16 +123,16 @@
123123
"deprecationMessage": "",
124124
"jsdoctags": [
125125
{
126-
"pos": 798,
127-
"end": 811,
126+
"pos": 832,
127+
"end": 845,
128128
"kind": 327,
129129
"id": 0,
130130
"flags": 16842752,
131131
"modifierFlagsCache": 0,
132132
"transformFlags": 0,
133133
"tagName": {
134-
"pos": 799,
135-
"end": 807,
134+
"pos": 833,
135+
"end": 841,
136136
"kind": 80,
137137
"id": 0,
138138
"flags": 16842752,
@@ -199,7 +199,7 @@
199199
"description": "",
200200
"rawdescription": "\n",
201201
"type": "component",
202-
"sourceCode": "import { CommonModule } from '@angular/common';\nimport { Component, Input, Output, EventEmitter } from '@angular/core';\n\n@Component({\n selector: 'storybook-button',\n standalone: true,\n imports: [CommonModule],\n template: ` <button\n type=\"button\"\n (click)=\"onClick.emit($event)\"\n [ngClass]=\"classes\"\n [ngStyle]=\"{ 'background-color': backgroundColor }\"\n >\n {{ label }}\n </button>`,\n styleUrls: ['./button.css'],\n})\nexport class ButtonComponent {\n /**\n * Is this the principal call to action on the page?\n */\n @Input()\n primary = false;\n\n /**\n * What background color to use\n */\n @Input()\n backgroundColor?: string;\n\n /**\n * How large should the button be?\n */\n @Input()\n size: 'small' | 'medium' | 'large' = 'medium';\n\n /**\n * Button contents\n *\n * @required\n */\n @Input()\n label = 'Button';\n\n /**\n * Optional click handler\n */\n @Output()\n onClick = new EventEmitter<Event>();\n\n public get classes(): string[] {\n const mode = this.primary ? 'storybook-button--primary' : 'storybook-button--secondary';\n\n return ['storybook-button', `storybook-button--${this.size}`, mode];\n }\n}\n",
202+
"sourceCode": "import { CommonModule } from '@angular/common';\nimport { Component, Input, Output, EventEmitter } from '@angular/core';\n\n@Component({\n selector: 'storybook-button',\n standalone: true,\n imports: [CommonModule],\n template: `<img src=\"/angular-gradient.png\"/> <button\n type=\"button\"\n (click)=\"onClick.emit($event)\"\n [ngClass]=\"classes\"\n [ngStyle]=\"{ 'background-color': backgroundColor }\"\n >\n {{ label }}\n </button>`,\n styleUrls: ['./button.css'],\n})\nexport class ButtonComponent {\n /**\n * Is this the principal call to action on the page?\n */\n @Input()\n primary = false;\n\n /**\n * What background color to use\n */\n @Input()\n backgroundColor?: string;\n\n /**\n * How large should the button be?\n */\n @Input()\n size: 'small' | 'medium' | 'large' = 'medium';\n\n /**\n * Button contents\n *\n * @required\n */\n @Input()\n label = 'Button';\n\n /**\n * Optional click handler\n */\n @Output()\n onClick = new EventEmitter<Event>();\n\n public get classes(): string[] {\n const mode = this.primary ? 'storybook-button--primary' : 'storybook-button--secondary';\n\n return ['storybook-button', `storybook-button--${this.size}`, mode];\n }\n}\n",
203203
"assetsDirs": [],
204204
"styleUrlsData": [
205205
{

public/angular-gradient.png

170 KB
Loading

src/stories/header.component.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,7 @@ import type { User } from './user';
1111
template: `<header>
1212
<div class="storybook-header">
1313
<div>
14-
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
15-
<g fill="none" fillRule="evenodd">
16-
<path
17-
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
18-
fill="#FFF"
19-
/>
20-
<path
21-
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
22-
fill="#555AB9"
23-
/>
24-
<path
25-
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
26-
fill="#91BAF8"
27-
/>
28-
</g>
29-
</svg>
14+
<img src="/angular-gradient.png" width="24px" height="24px"/>
3015
<h1>Acme</h1>
3116
</div>
3217
<div>

0 commit comments

Comments
 (0)