page about zodiac sign done, added buttons for man and woman info

This commit is contained in:
s473561 2023-06-10 19:22:13 +02:00
parent 362c6a2a06
commit 7f5b057e8e
12 changed files with 101 additions and 19 deletions

View File

@ -1,7 +1,16 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HoroscopeDataContainerComponent } from './horoscope-data-container/horoscope-data-container.component';
import {MockLoginComponent} from './mock-login/mock-login.component';
const routes: Routes = [];
const routes: Routes = [
{
path: 'horoscope',
component: HoroscopeDataContainerComponent
},
{ path: 'login', component: MockLoginComponent },
{ path: '', redirectTo: '/horoscope', pathMatch: 'full' },
];
@NgModule({
imports: [RouterModule.forRoot(routes)],

View File

@ -2,4 +2,6 @@
<!-- <router-outlet></router-outlet> -->
<!-- <app-horoscope></app-horoscope> -->
<app-horoscope-data-container></app-horoscope-data-container>
<!-- <app-horoscope-data-container></app-horoscope-data-container>
-->
<router-outlet></router-outlet>

View File

@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
// import { AppRoutingModule } from './app-routing.module';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { HoroscopeComponent } from './horoscope/horoscope.component';
@ -18,7 +18,7 @@ import { HoroscopeDataContainerComponent } from './horoscope-data-container/horo
],
imports: [
BrowserModule,
// AppRoutingModule,
AppRoutingModule,
HttpClientModule,
FormsModule,
FontAwesomeModule

View File

@ -4,5 +4,6 @@
</form>
</div>
<app-horoscope [horoscopeData]="horoscopeData1" >
<app-horoscope [horoscopeData]="horoscopeData1" (newSignEvent) = "changeGender"
>
</app-horoscope>

View File

@ -16,6 +16,7 @@ export class HoroscopeDataContainerComponent implements OnInit {
public sunSign: string = 'Libra'
public horoscopeData1?: HoroscopeData;
public gender: string = 'woman';
constructor (private openHoroscopeService: OpenHoroscopeService) {
@ -41,4 +42,8 @@ export class HoroscopeDataContainerComponent implements OnInit {
});
}
changeGender(newValue: string) {
this.gender = newValue;
}
}

View File

@ -58,17 +58,20 @@
<div class="second-column">
<div class="details-block">
<p class="text-center">
{{ horoscopeData.about }}
</p>
<div class="button-row">
<button class="button" (click)="changeGender('woman')" [style.background-color]=" gender == 'woman'? '#9c6464 ': '#728c5d' ">Woman</button>
<button class="button" (click)="changeGender('man')" [style.background-color]=" gender == 'man'? '#D3774b': '#728c5d' ">Man</button>
</div>
<div class="details-label">
Compatibility
</div>
<div class="details-block">
{{ horoscopeData.compatibility }}
<p>
Get to know yourself {{ gender }}
</p>
</div>
<div class="details-block" *ngIf="gender === 'woman'">
{{ horoscopeData.woman }}
</div>
<div class="details-block" *ngIf="gender === 'man'">
{{ horoscopeData.man }}
</div>
</div>
</div>

View File

@ -15,21 +15,28 @@ export class HoroscopeComponent implements OnInit {
faFire = faFire;
faCalendar = faCalendar;
@Input()
public gender: string = 'woman'
@Input()
public horoscopeData?: HoroscopeData;
@Output()
public sunSign: string = 'Libra'
newSignEvent = new EventEmitter<string>();
constructor(
) { }
onSubmit() {
onSubmit() {
}
ngOnInit(): void {
}
ngOnInit(): void {
}
changeGender(value: string) {
this.gender = value;
this.newSignEvent.emit(this.gender)
}
}

View File

@ -0,0 +1 @@
<p>mock-login works!</p>

View File

@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MockLoginComponent } from './mock-login.component';
describe('MockLoginComponent', () => {
let component: MockLoginComponent;
let fixture: ComponentFixture<MockLoginComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [MockLoginComponent]
});
fixture = TestBed.createComponent(MockLoginComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-mock-login',
templateUrl: './mock-login.component.html',
styleUrls: ['./mock-login.component.css']
})
export class MockLoginComponent {
}

View File

@ -174,4 +174,27 @@ body {
.details-label {
margin-top: 1em;
color: var(--white)
}
.details-label p {
text-align: center;
}
.button-row {
display: flex;
flex-direction: row;
padding-top: 1em;
justify-content: center;
align-items: center;
}
.button {
border-radius: 20px;
padding: 0.8em;
background-color: var(--green-1);
color: black;
border: none;
color: white;
margin-right: 10%;
}
.button #woman{
background-color: pink;
}