Skip to content

Commit 5672a80

Browse files
committed
feat: refactor Button component to use host selector and update usage in NewTicket and Header components
1 parent 1bf623b commit 5672a80

File tree

5 files changed

+34
-37
lines changed

5 files changed

+34
-37
lines changed
Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
button {
2-
display: inline-block;
3-
padding: 0.65rem 1.35rem;
4-
border-radius: 0.25rem;
5-
font-size: 1rem;
6-
text-align: center;
7-
cursor: pointer;
8-
background-color: #691ebe;
9-
color: white;
10-
border: none;
11-
}
12-
13-
button:hover {
14-
background-color: #551b98;
15-
}
16-
17-
.icon {
18-
display: inline-block;
19-
margin-left: 0.5rem;
20-
transition: transform 0.2s ease-in-out;
21-
}
22-
23-
button:hover .icon {
24-
transform: translateX(4px);
25-
}
26-
1+
:host {
2+
display: inline-block;
3+
padding: 0.65rem 1.35rem;
4+
border-radius: 0.25rem;
5+
font-size: 1rem;
6+
text-align: center;
7+
cursor: pointer;
8+
background-color: #691ebe;
9+
color: white;
10+
border: none;
11+
}
12+
13+
:host:hover {
14+
background-color: #551b98;
15+
}
16+
17+
.icon {
18+
display: inline-block;
19+
margin-left: 0.5rem;
20+
transition: transform 0.2s ease-in-out;
21+
}
22+
23+
:host:hover .icon {
24+
transform: translateX(4px);
25+
}
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
<button>
2-
<span>
3-
{{ buttonTitle() }}
4-
</span>
5-
<span class="icon">
6-
7-
</span>
8-
</button>
1+
<span>
2+
{{ buttonTitle() }}
3+
</span>
4+
<span class="icon">
5+
6+
</span>

06-cmp-deep-dive/01-starting-project/src/app/dashboard/shared/button/button.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, input } from '@angular/core';
22

33
@Component({
4-
selector: 'app-button',
4+
selector: 'button[appButton], a[appButton]',
55
standalone: true,
66
imports: [],
77
templateUrl: './button.component.html',

06-cmp-deep-dive/01-starting-project/src/app/dashboard/tickets/new-ticket/new-ticket.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
<textarea name="request" id="request" rows="3"></textarea>
77
</app-control>
88
<p>
9-
<app-button buttonTitle="Submit"></app-button>
9+
<button appButton buttonTitle="Submit"></button>
1010
</p>
1111
</form>

06-cmp-deep-dive/01-starting-project/src/app/header/header.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<a href="/">Management</a>
1313
</li>
1414
<li>
15-
<app-button buttonTitle="Logout"/>
15+
<button appButton buttonTitle="Logout"></button>
1616
</li>
1717
</ul>
1818
</nav>

0 commit comments

Comments
 (0)