Skip to content

Commit 3cb3131

Browse files
committed
added
1 parent bd49fb3 commit 3cb3131

7 files changed

+84
-4
lines changed

package-lock.json

+34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@angular/platform-browser-dynamic": "^14.1.0",
2020
"@angular/router": "^14.1.0",
2121
"bootstrap": "^5.2.0",
22+
"ckeditor4-angular": "^3.1.1",
2223
"rxjs": "~7.5.0",
2324
"tslib": "^2.3.0",
2425
"zone.js": "~0.11.4"

src/app/app.module.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import { HomeComponent } from './home/home.component';
99
import { StoryComponent } from './story/story.component';
1010
import { DiaryComponent } from './diary/diary.component';
1111
import { IdeaComponent } from './idea/idea.component';
12+
import { ReactiveFormsModule } from '@angular/forms';
13+
import { CKEditorModule } from 'ckeditor4-angular';
14+
1215

1316
@NgModule({
1417
declarations: [
@@ -22,7 +25,9 @@ import { IdeaComponent } from './idea/idea.component';
2225
],
2326
imports: [
2427
BrowserModule,
25-
AppRoutingModule
28+
AppRoutingModule,
29+
ReactiveFormsModule,
30+
CKEditorModule
2631
],
2732
providers: [],
2833
bootstrap: [AppComponent]

src/app/story/story.component.html

+19
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,24 @@
9797
<button class="btn btn-outline-danger">Delete</button>
9898
</div>
9999
</div>
100+
<div *ngIf="createStory" class="mx-5 my-4">
101+
<p class="fs-3 text-center">Add Your Story</p>
102+
<form [formGroup]="storyForm">
103+
<div class="form-floating mb-3">
104+
<input type="text" class="form-control" id="floatingInputValue" formControlName="title">
105+
<label for="floatingInputValue">Title</label>
106+
</div>
107+
108+
<ckeditor data="<p>Hello, world!</p>" formControlName="content"></ckeditor>
109+
<div class="form-floating my-3">
110+
<input type="date" class="form-control" id="floatingInputValue" formControlName="title">
111+
<label for="floatingInputValue">Completion Date</label>
112+
</div>
113+
114+
<button type="submit" (click)="addStory();createStory=false;listing=true" class="btn btn-primary">Submit
115+
</button>
116+
117+
</form>
118+
</div>
100119
</div>
101120
</div>

src/app/story/story.component.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { Component, OnInit } from '@angular/core';
2+
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
3+
// import * as ClassicEditor from '@ckeditor/ckeditor5-build-classic';
24

35
@Component({
46
selector: 'app-story',
@@ -7,9 +9,21 @@ import { Component, OnInit } from '@angular/core';
79
})
810
export class StoryComponent implements OnInit {
911

10-
constructor() { }
11-
listing: boolean = true;
12+
listing: boolean = false;
13+
createStory: boolean = true;
14+
// public editor = ClassicEditor;
15+
storyForm!: FormGroup;
16+
constructor(private formbuilder: FormBuilder) { }
17+
1218
ngOnInit(): void {
19+
this.storyForm = this.formbuilder.group({
20+
title: ['', [Validators.required, Validators.minLength(255)]],
21+
content: ['', Validators.required],
22+
date: ['', [Validators.required]],
23+
});
1324
}
25+
addStory() {
26+
1427

28+
}
1529
}

src/app/story/story.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export class Story {
2+
title!: String;
3+
content!: String;
4+
com!: Date;
5+
}

tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"noImplicitOverride": true,
1010
"noPropertyAccessFromIndexSignature": true,
1111
"noImplicitReturns": true,
12+
"noImplicitAny": false,
1213
"noFallthroughCasesInSwitch": true,
1314
"sourceMap": true,
1415
"declaration": false,
@@ -18,6 +19,7 @@
1819
"importHelpers": true,
1920
"target": "es2020",
2021
"module": "es2020",
22+
"allowJs": true,
2123
"lib": [
2224
"es2020",
2325
"dom"
@@ -29,4 +31,4 @@
2931
"strictInputAccessModifiers": true,
3032
"strictTemplates": true
3133
}
32-
}
34+
}

0 commit comments

Comments
 (0)