Commit afd6ce4e authored by Natthaphong Malaphan's avatar Natthaphong Malaphan 😊

again

parent b3f6bf9f
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { StudentComponent } from './student/student.component';
import { LecturerComponent } from './lecturer/lecturer.component';
import { ScoreComponent } from './score/score.component';
const routes: Routes = []; const routes: Routes = [
{path : 'student',component : StudentComponent },
{path : 'lecturer',component : LecturerComponent },
{path : 'score',component : ScoreComponent },
];
@NgModule({ @NgModule({
imports: [RouterModule.forRoot(routes)], imports: [RouterModule.forRoot(routes)],
......
<div class="toolbar" role="banner"> <div class="topnav" role="banner">
<span>HOME</span> <span> {{ title }} </span>
<a href="">STUDENT</a> <div *ngFor="let s of page">
<a href="">POINT</a> <a routerLink="/{{s}}" routerLinkActive="active">
&nbsp; {{s}}
</a>
</div>
<div class="spacer"></div> <div class="spacer"></div>
<a href="#">LOGIN</a> <a href="#">LOGIN</a>
...@@ -9,16 +12,11 @@ ...@@ -9,16 +12,11 @@
<div class="content" role="main"> <div class="content" role="main">
<div class="card highlight-card"> <div class="card highlight-card">
<h1>
Welcome to " {{ title }} " Welcome to " {{ title }} "
</h1>
</div> </div>
<div *ngFor="let s of students" class="card">
{{s.id}} {{s.name}}
<hr style="height:2px;border-width:0;color:gray;background-color:gray">
{{s.email}}
</div>
</div> </div>
<router-outlet></router-outlet> <router-outlet></router-outlet>
...@@ -23,6 +23,41 @@ ...@@ -23,6 +23,41 @@
.spacer { .spacer {
flex: 1; flex: 1;
} }
/* Add a black background color to the top navigation */
/* Add a black background color to the top navigation */
.topnav {
background-color: #333;
overflow: hidden;
}
/* Style the links inside the navigation bar */
.topnav a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
/* Change the color of links on hover */
.topnav a:hover {
background-color: #ddd;
color: black;
}
/* Add an active class to highlight the current page */
.topnav a.active {
background-color: #4CAF50;
color: white;
}
/* Hide the link that should open and close the topnav on small screens */
.topnav .icon {
display: none;
}
.toolbar { .toolbar {
position: absolute; position: absolute;
......
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Student } from './models/student'; import { Student } from './models/model';
import { STUDENTS } from './mock/mock-student'; import { STUDENTS } from './mock/mock-data';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
...@@ -11,6 +11,6 @@ import { STUDENTS } from './mock/mock-student'; ...@@ -11,6 +11,6 @@ import { STUDENTS } from './mock/mock-student';
export class AppComponent { export class AppComponent {
title = 'Course Web Application'; title = 'Course Web Application';
description = 'details'; description = 'details';
students: Student[] = STUDENTS;
demo = {id: 60111111, name: 'name', email: 'name@gmail.com'}; demo = {id: 60111111, name: 'name', email: 'name@gmail.com'};
page = ['student','lecturer','score']
} }
...@@ -3,10 +3,16 @@ import { NgModule } from '@angular/core'; ...@@ -3,10 +3,16 @@ import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { StudentComponent } from './student/student.component';
import { LecturerComponent } from './lecturer/lecturer.component';
import { ScoreComponent } from './score/score.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent AppComponent,
StudentComponent,
LecturerComponent,
ScoreComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
......
<p>lecturer works!</p>
<div *ngFor="let s of lecturer" class="card">
{{s.id}} {{s.name}}
{{s.email}}
<hr style="height:2px;border-width:0;color:gray;background-color:gray">
</div>
.card svg.material-icons path {
fill: #888;
}
.card-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-top: 16px;
}
.card {
max-width: 500px;
margin: auto;
border-radius: 4px;
border: 1px solid #eee;
background-color: #fafafa;
height: 40px;
width: 200px;
padding: 16px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
transition: all 0.2s ease-in-out;
line-height: 24px;
}
.card-container .card:not(:last-child) {
margin-right: 0;
}
.card.card-small {
height: 16px;
width: 168px;
}
.card-container .card:not(.highlight-card) {
cursor: pointer;
}
.card-container .card:not(.highlight-card):hover {
transform: translateY(-3px);
box-shadow: 0 4px 17px rgba(0, 0, 0, 0.35);
}
.card-container .card:not(.highlight-card):hover .material-icons path {
fill: rgb(105, 103, 103);
}
.card.highlight-card {
background-color: #fdb42c;
color: white;
font-weight: 600;
border: none;
width: auto;
min-width: 30%;
position: relative;
}
.card.card.highlight-card span {
margin-left: 60px;
}
svg#rocket {
width: 80px;
position: absolute;
left: -10px;
top: -24px;
}
svg#rocket-smoke {
height: calc(100vh - 95px);
position: absolute;
top: 10px;
right: 180px;
z-index: -10;
}
a,
a:visited,
a:hover {
color: #1976d2;
text-decoration: none;
}
a:hover {
color: #125699;
}
.terminal {
position: relative;
width: 80%;
max-width: 600px;
border-radius: 6px;
padding-top: 45px;
margin-top: 8px;
overflow: hidden;
background-color: rgb(15, 15, 16);
}
.terminal::before {
content: "\2022 \2022 \2022";
position: absolute;
top: 0;
left: 0;
height: 4px;
background: rgb(58, 58, 58);
color: #c2c3c4;
width: 100%;
font-size: 2rem;
line-height: 0;
padding: 14px 0;
text-indent: 4px;
}
.terminal pre {
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
color: white;
padding: 0 1rem 1rem;
margin: 0;
}
.circle-link {
height: 40px;
width: 40px;
border-radius: 40px;
margin: 8px;
background-color: white;
border: 1px solid #eeeeee;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
transition: 1s ease-out;
}
.circle-link:hover {
transform: translateY(-0.25rem);
box-shadow: 0px 3px 15px rgba(0, 0, 0, 0.2);
}
footer {
margin-top: 8px;
display: flex;
align-items: center;
line-height: 20px;
}
footer a {
display: flex;
align-items: center;
}
.github-star-badge {
color: #24292e;
display: flex;
align-items: center;
font-size: 12px;
padding: 3px 10px;
border: 1px solid rgba(27,31,35,.2);
border-radius: 3px;
background-image: linear-gradient(-180deg,#fafbfc,#eff3f6 90%);
margin-left: 4px;
font-weight: 600;
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
}
.github-star-badge:hover {
background-image: linear-gradient(-180deg,#f0f3f6,#e6ebf1 90%);
border-color: rgba(27,31,35,.35);
background-position: -.5em;
}
.github-star-badge .material-icons {
height: 16px;
width: 16px;
margin-right: 4px;
}
svg#clouds {
position: fixed;
bottom: -160px;
left: -230px;
z-index: -10;
width: 1920px;
}
/* Responsive Styles */
@media screen and (max-width: 767px) {
.card-container > *:not(.circle-link) ,
.terminal {
width: 100%;
}
.card:not(.highlight-card) {
height: 16px;
margin: 8px 0;
}
.card.highlight-card span {
margin-left: 72px;
}
svg#rocket-smoke {
right: 120px;
transform: rotate(-5deg);
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LecturerComponent } from './lecturer.component';
describe('LecturerComponent', () => {
let component: LecturerComponent;
let fixture: ComponentFixture<LecturerComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LecturerComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LecturerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { Lecturer } from '../models/model';
import { LECTURER } from '../mock/mock-data';
@Component({
selector: 'app-lecturer',
templateUrl: './lecturer.component.html',
styleUrls: ['./lecturer.component.scss']
})
export class LecturerComponent implements OnInit {
lecturer : Lecturer[] = LECTURER ;
constructor() { }
ngOnInit(): void {
}
}
import { Student } from '../models/student'; import { Student,Lecturer } from '../models/model';
export const STUDENTS: Student[] = [ export const STUDENTS: Student[] = [
{id: 6011444001, name: 'Gegy', email: 'gegy@gmail.com'}, {id: 6011444001, name: 'Gegy', email: 'gegy@gmail.com'},
...@@ -6,3 +6,10 @@ export const STUDENTS: Student[] = [ ...@@ -6,3 +6,10 @@ export const STUDENTS: Student[] = [
{id: 6011444003, name: 'Dedy', email: 'dedy@gmail.com'}, {id: 6011444003, name: 'Dedy', email: 'dedy@gmail.com'},
{id: 6011444004, name: 'Dada', email: 'dada@gmail.com'}, {id: 6011444004, name: 'Dada', email: 'dada@gmail.com'},
]; ];
export const LECTURER: Lecturer[] = [
{id: 1010010101, name: 'Lynzy', email: 'lynzy@gamil.com'},
{id: 1010010225, name: 'Rosy', email: 'rose@gamil.com'},
{id: 1010010654, name: 'Rockzy', email: 'rock@gamil.com'},
{id: 1010010825, name: 'zoozy', email: 'zoo@gamil.com'},
];
...@@ -3,3 +3,9 @@ export interface Student { ...@@ -3,3 +3,9 @@ export interface Student {
name: string; name: string;
email: string; email: string;
} }
export interface Lecturer {
id: number;
name: string;
email: string;
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ScoreComponent } from './score.component';
describe('ScoreComponent', () => {
let component: ScoreComponent;
let fixture: ComponentFixture<ScoreComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ScoreComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ScoreComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-score',
templateUrl: './score.component.html',
styleUrls: ['./score.component.scss']
})
export class ScoreComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
<p>student works!</p>
<div *ngFor="let s of students" class="card">
{{s.id}} {{s.name}}
{{s.email}}
<hr style="height:2px;border-width:0;color:gray;background-color:gray">
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { StudentComponent } from './student.component';
describe('StudentComponent', () => {
let component: StudentComponent;
let fixture: ComponentFixture<StudentComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ StudentComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(StudentComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { Student } from '../models/model';
import { STUDENTS } from '../mock/mock-data';
@Component({
selector: 'app-student',
templateUrl: './student.component.html',
styleUrls: ['./student.component.scss']
})
export class StudentComponent implements OnInit {
students: Student[] = STUDENTS;
constructor() { }
ngOnInit(): void {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment