-
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.
Merge pull request #4 from actionanand/2-features
2 features
- Loading branch information
Showing
10 changed files
with
222 additions
and
14 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
6 changes: 3 additions & 3 deletions
6
src/app/components/dashboard/tickets/new-ticket/new-ticket.component.html
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
19 changes: 16 additions & 3 deletions
19
src/app/components/dashboard/tickets/new-ticket/new-ticket.component.ts
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 |
---|---|---|
@@ -1,13 +1,26 @@ | ||
import { Component } from '@angular/core'; | ||
import { Component, ElementRef, EventEmitter, Output, viewChild } from '@angular/core'; | ||
import { FormsModule } from '@angular/forms'; | ||
// import { ViewChild } from '@angular/core'; | ||
|
||
import { ButtonComponent } from '../../../../shared/ui/button/button.component'; | ||
import { ControlComponent } from '../../../../shared/ui/control/control.component'; | ||
|
||
@Component({ | ||
selector: 'app-new-ticket', | ||
standalone: true, | ||
imports: [ButtonComponent, ControlComponent], | ||
imports: [ButtonComponent, ControlComponent, FormsModule], | ||
templateUrl: './new-ticket.component.html', | ||
styleUrl: './new-ticket.component.scss', | ||
}) | ||
export class NewTicketComponent {} | ||
export class NewTicketComponent { | ||
// @ViewChild('form') private form?: ElementRef<HTMLFormElement>; | ||
private form = viewChild.required<ElementRef<HTMLFormElement>>('form'); | ||
@Output() addTicket = new EventEmitter<{ title: string; text: string }>(); | ||
|
||
onSubmit(title: string, text: string) { | ||
console.log(this.form()); | ||
this.form()?.nativeElement.reset(); | ||
|
||
this.addTicket.emit({ title, text }); | ||
} | ||
} |
41 changes: 40 additions & 1 deletion
41
src/app/components/dashboard/tickets/ticket/ticket.component.html
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 |
---|---|---|
@@ -1 +1,40 @@ | ||
<p>ticket works!</p> | ||
<article> | ||
<h3> | ||
<div | ||
[class]="{ | ||
'ticket-open': true, | ||
'ticket-closed': false, | ||
}"></div> | ||
<button> | ||
<span class="text">TITLE</span> | ||
<span> | ||
@if (true) { | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke-width="1.5" | ||
stroke="currentColor" | ||
class="w-6 h-6"> | ||
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" /> | ||
</svg> | ||
} @else { | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"> | ||
<path | ||
fill-rule="evenodd" | ||
d="M11.47 7.72a.75.75 0 0 1 1.06 0l7.5 7.5a.75.75 0 1 1-1.06 1.06L12 9.31l-6.97 6.97a.75.75 0 0 1-1.06-1.06l7.5-7.5Z" | ||
clip-rule="evenodd" /> | ||
</svg> | ||
} | ||
</span> | ||
</button> | ||
</h3> | ||
|
||
@if (true) { | ||
<p>TEXT</p> | ||
|
||
@if (true) { | ||
<p><button>Mark as completed</button></p> | ||
} | ||
} | ||
</article> |
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,73 @@ | ||
article { | ||
border-radius: 4px; | ||
background-color: #59555f; | ||
color: #ded8e6; | ||
} | ||
|
||
h3 { | ||
padding: 0.5rem; | ||
margin: 0; | ||
font-size: 0.9rem; | ||
display: flex; | ||
gap: 0.5rem; | ||
align-items: center; | ||
} | ||
|
||
h3 div { | ||
width: 0.9rem; | ||
height: 0.9rem; | ||
border-radius: 50%; | ||
} | ||
|
||
.ticket-open { | ||
background-color: #de62e9; | ||
} | ||
|
||
.ticket-closed { | ||
background-color: #51c788; | ||
} | ||
|
||
.text { | ||
text-align: left; | ||
} | ||
|
||
button { | ||
flex: 1; | ||
width: 100%; | ||
font: inherit; | ||
background: transparent; | ||
border: none; | ||
color: #ded8e6; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
button span:first-child { | ||
margin-bottom: 0.1rem; | ||
} | ||
|
||
button span:last-child { | ||
width: 1rem; | ||
} | ||
|
||
p { | ||
margin: 0; | ||
padding: 1rem; | ||
font-size: 0.9rem; | ||
} | ||
|
||
p:has(button) { | ||
padding-top: 0; | ||
} | ||
|
||
p button { | ||
padding: 0; | ||
width: auto; | ||
display: inline; | ||
font-size: 0.75rem; | ||
} | ||
|
||
p button:hover { | ||
color: #ec9fea; | ||
} |
14 changes: 13 additions & 1 deletion
14
src/app/components/dashboard/tickets/tickets.component.html
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 |
---|---|---|
@@ -1,3 +1,15 @@ | ||
<div> | ||
<ul> | ||
@for (ticket of tickets; track ticket.id) { | ||
<li> | ||
<app-ticket /> | ||
</li> | ||
} @empty { | ||
<p>No Tickets Available!</p> | ||
} | ||
</ul> | ||
</div> | ||
|
||
<div id="new-ticket"> | ||
<app-new-ticket /> | ||
<app-new-ticket (addTicket)="onAddTicket($event)" /> | ||
</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 |
---|---|---|
@@ -1,12 +1,27 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
import { NewTicketComponent } from './new-ticket/new-ticket.component'; | ||
import { Status, Ticket } from '../../../models/ticket.model'; | ||
import { TicketComponent } from './ticket/ticket.component'; | ||
|
||
@Component({ | ||
selector: 'app-tickets', | ||
standalone: true, | ||
imports: [NewTicketComponent], | ||
imports: [NewTicketComponent, TicketComponent], | ||
templateUrl: './tickets.component.html', | ||
styleUrl: './tickets.component.scss', | ||
}) | ||
export class TicketsComponent {} | ||
export class TicketsComponent { | ||
tickets: Ticket[] = []; | ||
|
||
onAddTicket(ticketData: { title: string; text: string }) { | ||
const ticket: Ticket = { | ||
title: ticketData.title, | ||
request: ticketData.text, | ||
id: Math.random().toString(), | ||
status: Status.OPEN, | ||
}; | ||
|
||
this.tickets.unshift(ticket); | ||
} | ||
} |
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,20 @@ | ||
/* | ||
export interface Ticket { | ||
id: string; | ||
title: string; | ||
request: string; | ||
status: 'open' | 'close'; | ||
} | ||
*/ | ||
|
||
export interface Ticket { | ||
id: string; | ||
title: string; | ||
request: string; | ||
status: Status; | ||
} | ||
|
||
export enum Status { | ||
OPEN = 'open', | ||
CLOSE = 'close', | ||
} |
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