Skip to content

Commit 627eccc

Browse files
committed
feat: switch to examples, remove storybook
1 parent 948d362 commit 627eccc

28 files changed

+13058
-28686
lines changed

.eslintrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@
3737
"jest": true
3838
},
3939
"rules": {}
40+
},
41+
{
42+
"files": ["*.ts", "*.tsx"],
43+
"rules": {
44+
"@angular-eslint/component-class-suffix": [
45+
"error",
46+
{
47+
"suffixes": ["Component", "Page"]
48+
}
49+
]
50+
}
4051
}
4152
]
4253
}

.storybook/main.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

.storybook/preview.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

.storybook/tsconfig.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

apps/examples/src/app/app.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<div class="flex h-full w-full">
22
<aside class="flex flex-col p-3">
33
Basic
4-
<a hlmBtn variant="link" routerLink="/basic/minimal">Minimal</a>
4+
<a hlmBtn variant="link" routerLink="/basic/minimal">Basic Setup</a>
5+
<a hlmBtn variant="link" routerLink="/basic/all-blocks">Default Schema Showcase</a>
56
Custom
67
<a hlmBtn variant="link" routerLink="/custom/alert-block">Alert Block</a>
78
</aside>

apps/examples/src/app/app.routes.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import { Route } from '@angular/router';
2-
import { BasicMinimal } from '../basic/minimal/basic-minimal.component';
2+
import { DefaultSchemaShowcasePage } from '../basic/default-schema-showcase/default-schema-showcase.page';
3+
import { BasicMinimalPage } from '../basic/minimal/basic-minimal.page';
34
import { CustomAlertBlockPage } from '../custom/alert-block/custom-alert-block.page';
45

56
export const appRoutes: Route[] = [
67
{ path: '', redirectTo: 'basic/minimal', pathMatch: 'full' },
7-
{ path: 'basic/minimal', component: BasicMinimal },
8+
{ path: 'basic/minimal', component: BasicMinimalPage },
9+
{
10+
path: 'basic/all-blocks',
11+
component: DefaultSchemaShowcasePage,
12+
},
813
{
914
path: 'custom/alert-block',
1015
component: CustomAlertBlockPage,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<bna-editor
2+
[initialContent]="initialContent"
3+
class="block min-h-52 bg-gray-200 rounded"
4+
5+
/>

apps/examples/src/basic/minimal/basic-minimal.component.spec.ts renamed to apps/examples/src/basic/default-schema-showcase/default-schema-showcase.page.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { BasicMinimal } from './basic-minimal.component';
2+
import { BasicMinimal } from './default-schema-showcase.page';
33

44
describe('CustomBlockExampleComponent', () => {
55
let component: BasicMinimal;
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
import { CommonModule } from '@angular/common';
2+
import { Component } from '@angular/core';
3+
import { ReactiveFormsModule } from '@angular/forms';
4+
import { BnaEditorComponent } from '@dytab/block-note-angular';
5+
import { HlmButtonDirective } from '@spartan-ng/ui-button-helm';
6+
7+
@Component({
8+
standalone: true,
9+
imports: [
10+
CommonModule,
11+
ReactiveFormsModule,
12+
BnaEditorComponent,
13+
HlmButtonDirective,
14+
],
15+
templateUrl: './default-schema-showcase.page.html',
16+
styleUrl: './default-schema-showcase.page.css',
17+
})
18+
export class DefaultSchemaShowcasePage {
19+
initialContent = [
20+
{
21+
type: 'paragraph',
22+
content: 'Welcome to this demo!',
23+
},
24+
{
25+
type: 'paragraph',
26+
},
27+
{
28+
type: 'paragraph',
29+
content: [
30+
{
31+
type: 'text',
32+
text: 'Blocks:',
33+
styles: { bold: true },
34+
},
35+
],
36+
},
37+
{
38+
type: 'paragraph',
39+
content: 'Paragraph',
40+
},
41+
{
42+
type: 'heading',
43+
content: 'Heading',
44+
},
45+
{
46+
type: 'bulletListItem',
47+
content: 'Bullet List Item',
48+
},
49+
{
50+
type: 'numberedListItem',
51+
content: 'Numbered List Item',
52+
},
53+
{
54+
type: 'checkListItem',
55+
content: 'Check List Item',
56+
},
57+
{
58+
type: 'table',
59+
content: {
60+
type: 'tableContent',
61+
rows: [
62+
{
63+
cells: ['Table Cell', 'Table Cell', 'Table Cell'],
64+
},
65+
{
66+
cells: ['Table Cell', 'Table Cell', 'Table Cell'],
67+
},
68+
{
69+
cells: ['Table Cell', 'Table Cell', 'Table Cell'],
70+
},
71+
],
72+
},
73+
},
74+
{
75+
type: 'file',
76+
},
77+
{
78+
type: 'image',
79+
props: {
80+
url: 'https://interactive-examples.mdn.mozilla.net/media/cc0-images/grapefruit-slice-332-332.jpg',
81+
caption:
82+
'From https://interactive-examples.mdn.mozilla.net/media/cc0-images/grapefruit-slice-332-332.jpg',
83+
},
84+
},
85+
{
86+
type: 'video',
87+
props: {
88+
url: 'https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm',
89+
caption:
90+
'From https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm',
91+
},
92+
},
93+
{
94+
type: 'audio',
95+
props: {
96+
url: 'https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3',
97+
caption:
98+
'From https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3',
99+
},
100+
},
101+
{
102+
type: 'paragraph',
103+
},
104+
{
105+
type: 'paragraph',
106+
content: [
107+
{
108+
type: 'text',
109+
text: 'Inline Content:',
110+
styles: { bold: true },
111+
},
112+
],
113+
},
114+
{
115+
type: 'paragraph',
116+
content: [
117+
{
118+
type: 'text',
119+
text: 'Styled Text',
120+
styles: {
121+
bold: true,
122+
italic: true,
123+
textColor: 'red',
124+
backgroundColor: 'blue',
125+
},
126+
},
127+
{
128+
type: 'text',
129+
text: ' ',
130+
styles: {},
131+
},
132+
{
133+
type: 'link',
134+
content: 'Link',
135+
href: 'https://www.blocknotejs.org',
136+
},
137+
],
138+
},
139+
{
140+
type: 'paragraph',
141+
},
142+
//TODO: remove casting
143+
] as any;
144+
}

apps/examples/src/basic/minimal/basic-minimal.component.html

Lines changed: 0 additions & 20 deletions
This file was deleted.

apps/examples/src/basic/minimal/basic-minimal.component.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<bna-editor
2+
[initialContent]="initialContent"
3+
class="block min-h-52 bg-gray-200 rounded"
4+
/>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { BasicMinimalPage } from './basic-minimal.page';
3+
4+
describe('CustomBlockExampleComponent', () => {
5+
let component: BasicMinimalPage;
6+
let fixture: ComponentFixture<BasicMinimalPage>;
7+
8+
beforeEach(async () => {
9+
await TestBed.configureTestingModule({
10+
imports: [BasicMinimalPage],
11+
}).compileComponents();
12+
13+
fixture = TestBed.createComponent(BasicMinimalPage);
14+
component = fixture.componentInstance;
15+
fixture.detectChanges();
16+
});
17+
18+
it('should create', () => {
19+
expect(component).toBeTruthy();
20+
});
21+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { CommonModule } from '@angular/common';
2+
import { Component } from '@angular/core';
3+
import { BnaEditorComponent } from '@dytab/block-note-angular';
4+
import { HlmButtonDirective } from '@spartan-ng/ui-button-helm';
5+
6+
@Component({
7+
standalone: true,
8+
imports: [CommonModule, BnaEditorComponent, HlmButtonDirective],
9+
templateUrl: './basic-minimal.page.html',
10+
styleUrl: './basic-minimal.page.css',
11+
})
12+
export class BasicMinimalPage {
13+
initialContent = undefined;
14+
}
Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
1-
<form
2-
[formGroup]="form"
3-
(ngSubmit)="submit()"
4-
class="flex gap-3 p-3 flex-col"
5-
>
6-
<fieldset>
7-
<label class="font-bold">Editor</label>
81
<bna-editor
9-
formControlName="editor"
2+
[initialContent]="initialContent"
103
class="block min-h-52 bg-gray-200 rounded"
114
[blockSpecs]="blockSpecs"
12-
135
/>
14-
@if (control.invalid && control.touched) {
15-
<em class="invalid-feedback">Required!</em>
16-
}
17-
</fieldset>
18-
<button hlmBtn>submit</button>
19-
<hr />
20-
<pre>{{ form.value | json }}</pre>
21-
</form>

0 commit comments

Comments
 (0)