-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a80ae34
commit a5eea4f
Showing
7 changed files
with
166 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="post-dialog-overlay" [class.show]="isDialogOpen"> | ||
<div class="post-dialog"> | ||
<textarea | ||
class="post-text" | ||
placeholder="What's on your mind?" | ||
rows="4" | ||
></textarea> | ||
<div class="dialog-actions"> | ||
<button class="btn-save" (click)="savePost()">Save</button> | ||
<button class="btn-cancel" (click)="closeDialog()">Cancel</button> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
@import "../.../../../../partials/variables"; | ||
|
||
.post-dialog-overlay { | ||
display: none; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
z-index: 1000; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
&.show { | ||
display: flex; | ||
} | ||
} | ||
|
||
.post-dialog { | ||
background: #fff; | ||
padding: 2rem; | ||
border-radius: 0; | ||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); | ||
width: 90%; | ||
max-width: 500px; | ||
} | ||
|
||
.post-text { | ||
width: calc(100% - 2rem); | ||
border: 1px solid #ccc; | ||
border-radius: 0; | ||
padding: 1rem; | ||
margin-bottom: 1rem; | ||
resize: vertical; | ||
|
||
&:focus { | ||
border-color: $inactive-color; | ||
outline: none; | ||
} | ||
} | ||
|
||
.dialog-actions { | ||
text-align: right; | ||
} | ||
|
||
.btn-save, | ||
.btn-cancel { | ||
padding: 0.5rem 1rem; | ||
border: none; | ||
border-radius: 0; | ||
margin-left: 0.5rem; | ||
cursor: pointer; | ||
font-weight: bold; | ||
transition: background-color 0.3s; | ||
} | ||
|
||
.btn-save { | ||
background-color: $accent-color; | ||
color: #fff; | ||
|
||
&:hover { | ||
background-color: darken($accent-color, 10%); | ||
} | ||
} | ||
|
||
.btn-cancel { | ||
background-color: #fff; | ||
color: $accent-color; | ||
border: 1px solid $accent-color; | ||
|
||
&:hover { | ||
background-color: lighten($accent-color, 40%); | ||
} | ||
} | ||
|
||
/* Responsive styling */ | ||
@media (max-width: 768px) { | ||
.post-dialog { | ||
padding: 1rem; | ||
width: 95%; | ||
} | ||
.post-text { | ||
padding: 0.5rem; | ||
width: calc(100% - 1rem); | ||
} | ||
.btn-save, | ||
.btn-cancel { | ||
padding: 0.5rem; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { PostDialogComponent } from './post-dialog.component'; | ||
|
||
describe('PostDialogComponent', () => { | ||
let component: PostDialogComponent; | ||
let fixture: ComponentFixture<PostDialogComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [PostDialogComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(PostDialogComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Component, EventEmitter, Input, Output } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'post-dialog', | ||
standalone: true, | ||
imports: [], | ||
templateUrl: './post-dialog.component.html', | ||
styleUrl: './post-dialog.component.scss' | ||
}) | ||
export class PostDialogComponent { | ||
|
||
@Input() isDialogOpen: boolean = false; | ||
@Output() closeWrite = new EventEmitter<boolean>(); | ||
openDialog(): void { | ||
this.isDialogOpen = true; | ||
} | ||
|
||
closeDialog(): void { | ||
this.isDialogOpen = false; | ||
this.closeWrite.emit(true); | ||
} | ||
|
||
savePost(): void { | ||
this.closeDialog(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters