Skip to content

Commit

Permalink
Updates 02/07 - New home page and fix routing (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Salgado2004 authored Jul 2, 2024
2 parents 93b0823 + c0e0bd1 commit b69014c
Show file tree
Hide file tree
Showing 18 changed files with 206 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Routes } from '@angular/router';

export const routes: Routes = [
{ path: '', redirectTo: '/simulados/home', pathMatch: 'full' },
{ path: '', redirectTo: '/simulados', pathMatch: 'full' },
{ path: 'simulados', loadChildren: () => import('./simulados/simulados.module').then(m => m.SimuladosModule) }
];
15 changes: 9 additions & 6 deletions src/app/simulados/componentes/exam-card/exam-card.component.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
:host{
display: block;
display: flex;
flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
width: 20%;
width: 23%;
border: 2px solid #319bf5;
background-color: #18202f;
border-radius: 16px;
padding: 16px;
margin: 12px;
margin-top: 8px;
}

picture{
Expand All @@ -30,16 +32,17 @@ p{
color: #fff;
font-size: 12pt;
font-weight: 500;
margin-bottom: 6px;
margin-bottom: 8px;
line-height: 1.5;
}

div{
.input{
display: flex;
justify-content: space-between;
align-items: center;
}

div span{
.input span{
color: #fff;
font-size: 10pt;
}
Expand Down
15 changes: 8 additions & 7 deletions src/app/simulados/componentes/exam-card/exam-card.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
</picture>
<p>{{ exam.fullname }}</p>
<div>
<span>Questões: </span>
<input type="number" max="{{ exam.questions }}" min="0"
[(ngModel)]="questions" (change)="validateQuestions()">
</div>
<a [routerLink]="['/simulados/exam/', exam.name, questions]">
<span>Praticar</span>
</a>
<div class="input">
<span>Questões: </span>
<input type="number" max="{{ exam.questions }}" min="0" [(ngModel)]="questions" (change)="validateQuestions()">
</div>
<a [routerLink]="['/simulados/exam/', exam.name, questions]">
<span>Praticar</span>
</a>
</div>
1 change: 1 addition & 0 deletions src/app/simulados/componentes/header/header.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
background-color: #080e19;
display: block;
box-sizing: border-box;
max-height: 10vh;
}

h1{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
:host{
width: 80%;
max-height: 90vh;
display: block;
box-sizing: border-box;
padding: 12px;
overflow-y: scroll;
}

.simulados{
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
justify-content: space-evenly;
}

@media (max-width: 590px) {
:host{
width: 100%;
}

.simulados{
justify-content: center;
padding: 12px;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<section>
<p>Selecione um simulado para começar: </p>
<app-loader *ngIf="loading"></app-loader>
<div class="simulados">
<app-exam-card *ngFor="let simulado of simulados" [exam]="simulado"></app-exam-card>
Expand Down
112 changes: 112 additions & 0 deletions src/app/simulados/componentes/sidenav/sidenav.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
:host {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
width: 20%;
background-color: #18202f;
}

.sidebar {
width: 100%;
}

.sidebar a {
display: block;
color: #fff;
padding: 16px;
text-decoration: none;
}

.sidebar a.active {
border-bottom: 2px solid #319bf5;
}

.sidebar a:hover {
background-color: #555;
}

.menu{
display: none;
height: auto;
padding: 4px;
background: transparent;
border: none;
outline: none;
float: right;
}

.menu img{
width: 36px;
}

.menu:hover {
background-color: #555;
}

.contribute {
background-color: #2f3643;
color: #fff;
padding: 16px 20px;
margin: 6px;
border-radius: 10px;
}

.contribute a {
display: flex;
align-items: center;
color: #319bf5;
text-decoration: none;
font-size: 10pt;
font-weight: bold;
}

.contribute a img{
max-height: 20px;
margin: 4px;
}

.contribute a:hover{
text-decoration: underline;
}

@media screen and (max-width: 800px) {
:host {
width: 100%;
}

.contribute {
position: absolute;
top: 25%;
width: 75%;
box-shadow: 2px 2px 5px #319bf5;
}

.menu{
display: block;
}

.hide{
display: none;
}

.sidebar {
height: auto;
position: relative;
}

.sidebar a {
float: left;
}

div.content {
margin-left: 0;
}
}

@media screen and (max-width: 400px) {
.sidebar a {
text-align: center;
float: none;
}
}
13 changes: 13 additions & 0 deletions src/app/simulados/componentes/sidenav/sidenav.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class="sidebar">
<a class="active" routerLink="/simulados">Simulados</a>
<button class="menu" (click)="showContribute()">
<img src="/assets/icons/menu.svg">
</button>
</div>
<div class="contribute hide">
<h5>Contribua para o projeto:</h5>
<a href="https://github.com/Salgado2004/CertCloud-Exams" target="_blank">
<img src="/assets/icons/github.svg">GitHub</a>
<a href="https://github.com/Salgado2004/CertCloud-Exams/discussions" target="_blank">
<img src="/assets/icons/comments-solid.svg">Discussões</a>
</div>
23 changes: 23 additions & 0 deletions src/app/simulados/componentes/sidenav/sidenav.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SidenavComponent } from './sidenav.component';

describe('SidenavComponent', () => {
let component: SidenavComponent;
let fixture: ComponentFixture<SidenavComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SidenavComponent]
})
.compileComponents();

fixture = TestBed.createComponent(SidenavComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
13 changes: 13 additions & 0 deletions src/app/simulados/componentes/sidenav/sidenav.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-sidenav',
templateUrl: './sidenav.component.html',
styleUrl: './sidenav.component.css'
})
export class SidenavComponent {
showContribute(){
let contribute = document.querySelector(".contribute");
contribute.classList.toggle("hide");
}
}
2 changes: 1 addition & 1 deletion src/app/simulados/pages/exam/exam.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<main>
<div class="top-section">
<h2>Simulado {{ exam.fullname }}</h2>
<a routerLink="/">
<a routerLink="/simulados">
<span>Voltar</span>
</a>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/app/simulados/pages/home/home.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@
margin: 0;
padding: 0;
box-sizing: border-box;
}

main{
display: flex;
flex-wrap: wrap;
height: 90vh;
}
1 change: 1 addition & 0 deletions src/app/simulados/pages/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<app-header></app-header>
</header>
<main>
<app-sidenav></app-sidenav>
<app-list-simulados></app-list-simulados>
</main>
4 changes: 3 additions & 1 deletion src/app/simulados/simulados.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import { RouterLink } from '@angular/router';
import { NgFor } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { SimuladosRoutingModule } from './simulados.route';
import { SimuladosRoutingModule } from './simulados.routes';

import { QueryQuestionsService } from './utils/query-questions.service';
import { QueryExamsService } from './utils/query-exams.service';

import { HomeComponent } from './pages/home/home.component';
import { ExamComponent } from './pages/exam/exam.component';
import { HeaderComponent } from './componentes/header/header.component';
import { SidenavComponent } from './componentes/sidenav/sidenav.component';
import { ExamCardComponent } from './componentes/exam-card/exam-card.component';
import { ExamSummaryComponent } from './componentes/exam-summary/exam-summary.component';
import { DomainSummaryComponent } from './componentes/domain-summary/domain-summary.component';
Expand Down Expand Up @@ -41,6 +42,7 @@ import { MatSelectModule } from '@angular/material/select';
HomeComponent,
ExamComponent,
HeaderComponent,
SidenavComponent,
ExamCardComponent,
ExamSummaryComponent,
QuestionsContainerComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { HomeComponent } from './pages/home/home.component';
import { ExamComponent } from './pages/exam/exam.component';

export const routes: Routes = [
{path: '', redirectTo: 'home', pathMatch: 'full'},
{path: '', redirectTo: '/simulados/home', pathMatch: 'full'},
{path: 'home' , component: HomeComponent},
{path: 'exam/:exam/:questions', component: ExamComponent}
];
Expand Down
2 changes: 2 additions & 0 deletions src/assets/icons/comments-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/assets/icons/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/icons/menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b69014c

Please sign in to comment.