-
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.
Add common buttons, add collapsable menu
- Loading branch information
Showing
11 changed files
with
118 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<button type="button" [class]="btnClass()"> | ||
<div class="h-6 *:pr-2"><ng-content select="ng-icon"></ng-content></div> | ||
<span> | ||
<ng-content /> | ||
</span> | ||
</button> |
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 { BtnComponent } from './btn.component'; | ||
|
||
describe('BtnComponent', () => { | ||
let component: BtnComponent; | ||
let fixture: ComponentFixture<BtnComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [BtnComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(BtnComponent); | ||
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,33 @@ | ||
import { Component, computed, input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-btn', | ||
standalone: true, | ||
imports: [], | ||
templateUrl: './btn.component.html', | ||
}) | ||
export class BtnComponent { | ||
main = input(false); | ||
|
||
btnClass = computed(() => { | ||
const clasess = ['h-12', 'flex', 'flex-row', 'items-center', 'rounded-lg', 'px-5', 'py-2.5', 'text-sm', 'font-medium']; | ||
|
||
if (this.main()) { | ||
return clasess.concat(['bg-primary-700', 'text-white', 'hover:bg-primary-800', 'focus:ring-primary-300', 'dark:bg-primary-600', 'dark:hover:bg-primary-700']); | ||
} else { | ||
return clasess.concat([ | ||
'border', | ||
'border-gray-200', | ||
'bg-white', | ||
'text-gray-900', | ||
'hover:bg-gray-100', | ||
'hover:text-primary-700', | ||
'dark:border-gray-600', | ||
'dark:bg-gray-800', | ||
'dark:text-gray-400', | ||
'dark:hover:bg-gray-700', | ||
'dark:hover:text-white', | ||
]); | ||
} | ||
}); | ||
} |
4 changes: 2 additions & 2 deletions
4
src/app/common-components/strava-btn/strava-btn.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,3 @@ | ||
<button type="button" (click)="onButtonClick()" (keydown)="onButtonClick()" class="h-full border-spacing-1 rounded-md bg-strava transition-opacity duration-500 hover:opacity-50"> | ||
<img src="assets/strava/login-orange.svg" alt="Login with strava" tabindex="-1" class="h-full object-contain" /> | ||
<button type="button" class="h-full rounded-md bg-strava transition-opacity duration-500 hover:opacity-50"> | ||
<img src="assets/strava/login-orange.svg" alt="Connect with strava" tabindex="-1" class="h-full" /> | ||
</button> |
15 changes: 4 additions & 11 deletions
15
src/app/common-components/strava-btn/strava-btn.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,19 +1,12 @@ | ||
import { Component } from '@angular/core'; | ||
import { EventEmitter, Output } from '@angular/core'; | ||
import { provideIcons, NgIconComponent } from '@ng-icons/core'; | ||
import { tablerLogin, tablerLogout } from '@ng-icons/tabler-icons'; | ||
import { Component, HostBinding } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-strava-btn', | ||
standalone: true, | ||
imports: [NgIconComponent], | ||
imports: [], | ||
templateUrl: './strava-btn.component.html', | ||
providers: [provideIcons({ tablerLogout, tablerLogin })], | ||
providers: [], | ||
}) | ||
export class StravaBtnComponent { | ||
@Output() clicked = new EventEmitter<void>(); | ||
|
||
onButtonClick() { | ||
this.clicked.emit(); | ||
} | ||
@HostBinding('class') class = 'h-12'; | ||
} |
42 changes: 25 additions & 17 deletions
42
src/app/components/main-layout/main-layout.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
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
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