From 84c1970d78e997301734ed514f37a4d403999e57 Mon Sep 17 00:00:00 2001 From: kj1352 Date: Sat, 27 Jun 2020 11:33:48 +0530 Subject: [PATCH] Class list card component integration with welcome page --- src/app/app.module.ts | 2 + .../class-card-list.component.html | 15 ++ .../class-card-list.component.scss | 113 ++++++++++++++++ .../class-card-list.component.spec.ts | 25 ++++ .../class-card-list.component.ts | 16 +++ src/app/tabs/home/home.component.scss | 128 ------------------ src/app/tabs/tabs.component.html | 4 +- src/app/welcome/welcome.component.html | 68 ++-------- src/app/welcome/welcome.component.scss | 116 ++++------------ src/app/welcome/welcome.component.ts | 88 ++++++++++++ 10 files changed, 294 insertions(+), 281 deletions(-) create mode 100644 src/app/reusable-components/class-card-list/class-card-list.component.html create mode 100644 src/app/reusable-components/class-card-list/class-card-list.component.scss create mode 100644 src/app/reusable-components/class-card-list/class-card-list.component.spec.ts create mode 100644 src/app/reusable-components/class-card-list/class-card-list.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index e22847b..ce0c307 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -32,6 +32,7 @@ import { PostDetailsComponent } from './reusable-components/forum/post-details/p import { ChatPageComponent } from './chat-page/chat-page.component'; import { ChatWindowComponent } from './chat-page/chat-window/chat-window.component'; import { SettingsComponent } from './settings/settings.component'; +import { ClassCardListComponent } from './reusable-components/class-card-list/class-card-list.component'; @NgModule({ declarations: [ @@ -56,6 +57,7 @@ import { SettingsComponent } from './settings/settings.component'; ChatPageComponent, ChatWindowComponent, SettingsComponent, + ClassCardListComponent, ], imports: [ BrowserModule, diff --git a/src/app/reusable-components/class-card-list/class-card-list.component.html b/src/app/reusable-components/class-card-list/class-card-list.component.html new file mode 100644 index 0000000..c5351ee --- /dev/null +++ b/src/app/reusable-components/class-card-list/class-card-list.component.html @@ -0,0 +1,15 @@ + diff --git a/src/app/reusable-components/class-card-list/class-card-list.component.scss b/src/app/reusable-components/class-card-list/class-card-list.component.scss new file mode 100644 index 0000000..04c4529 --- /dev/null +++ b/src/app/reusable-components/class-card-list/class-card-list.component.scss @@ -0,0 +1,113 @@ +.subject-list { + position: relative; + width: 100%; + margin: 0 auto; + list-style: none; + + @media screen and (min-width: 1023px) { + width: 33%; + margin: 0; + max-height: 50vh; + position: fixed; + right: 2%; + top: calc(50vh - 30px); + background-color: white; + border-radius: 30px; + padding: 15px; + box-shadow: 0px 0px 10px rgba(black, 0.3); + z-index: 1; + overflow: auto; + } + + li { + background-color: white; + border-radius: 15px; + overflow: hidden; + display: flex; + align-items: center; + padding: 15px 10px; + margin-top: 15px; + box-shadow: 0px 0px 5px -2px var(--black); + position: relative; + + &::before { + content: ''; + position: absolute; + left: 0; + top: 0; + width: 7px; + height: 100%; + background-color: transparent; + } + + &.attended::before { + background-color: var(--teal-green); + } + + &.absent::before { + background-color: var(--danger); + } + + &.late::before { + background-color: rgba(orange, 0.5); + } + } + + .schedule { + width: 80px; + padding-right: 15px; + text-align: center; + } + + .subject { + flex-grow: 1; + border-left: 1px solid #cecece; + padding-left: 15px; + overflow: hidden; + + p { + margin-top: 5px; + } + } + + .view-button { + height: 33px; + border-radius: 5px; + border: 0px; + background-color: var(--teal-green); + color: white; + font-size: 14px; + width: 80px; + margin-left: 10px; + } + + label { + font-size: 14px; + color: var(--black); + font-weight: 500; + } + + p { + font-size: 13px; + color: var(--dark-grey); + margin-top: 2px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + + img { + width: 20px; + height: 20px; + border-radius: 50%; + overflow: hidden; + object-fit: cover; + object-position: top; + vertical-align: middle; + } + + span { + vertical-align: middle; + margin-left: 3px; + } + } +} diff --git a/src/app/reusable-components/class-card-list/class-card-list.component.spec.ts b/src/app/reusable-components/class-card-list/class-card-list.component.spec.ts new file mode 100644 index 0000000..81f728b --- /dev/null +++ b/src/app/reusable-components/class-card-list/class-card-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ClassCardListComponent } from './class-card-list.component'; + +describe('ClassCardListComponent', () => { + let component: ClassCardListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ClassCardListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ClassCardListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/reusable-components/class-card-list/class-card-list.component.ts b/src/app/reusable-components/class-card-list/class-card-list.component.ts new file mode 100644 index 0000000..c189ffa --- /dev/null +++ b/src/app/reusable-components/class-card-list/class-card-list.component.ts @@ -0,0 +1,16 @@ +import { Component, OnInit, Input, Output } from '@angular/core'; + +@Component({ + selector: 'app-class-card-list', + templateUrl: './class-card-list.component.html', + styleUrls: ['./class-card-list.component.scss'] +}) +export class ClassCardListComponent implements OnInit { + @Input() classes: any; + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/tabs/home/home.component.scss b/src/app/tabs/home/home.component.scss index 7afa207..dac1a66 100644 --- a/src/app/tabs/home/home.component.scss +++ b/src/app/tabs/home/home.component.scss @@ -371,131 +371,3 @@ } } } - -.subject-list { - position: relative; - width: 88%; - margin: 0 auto; - list-style: none; - - @media screen and (min-width: 1023px) { - width: 33%; - margin: 0; - max-height: 50vh; - position: fixed; - right: 2%; - top: calc(50vh - 30px); - background-color: white; - border-radius: 30px; - padding: 15px; - box-shadow: 0px 0px 10px rgba(black, 0.3); - z-index: 1; - overflow: auto; - } - - header { - color: var(--black); - - h5 { - font-size: 14px; - margin-top: 30px; - font-weight: 500; - } - - &:first-child h5 { - margin-top: 20px; - } - } - - li { - background-color: white; - border-radius: 15px; - overflow: hidden; - display: flex; - align-items: center; - padding: 15px 10px; - margin-top: 15px; - box-shadow: 0px 0px 5px -2px var(--black); - position: relative; - - &::before { - content: ''; - position: absolute; - left: 0; - top: 0; - width: 7px; - height: 100%; - background-color: transparent; - } - - &.attended::before { - background-color: var(--teal-green); - } - - &.absent::before { - background-color: var(--danger); - } - - &.late::before { - background-color: rgba(orange, 0.5); - } - } - - .schedule { - width: 80px; - padding: 0 5px; - text-align: center; - } - - .subject { - flex-grow: 1; - border-left: 1px solid #cecece; - padding-left: 15px; - overflow: hidden; - - p { - margin-top: 10px; - } - } - - .view-button { - height: 33px; - border-radius: 5px; - border: 0px; - background-color: var(--teal-green); - color: white; - font-size: 14px; - width: 80px; - margin-left: 10px; - } - - label { - font-size: 16px; - color: var(--black); - font-weight: 500; - } - - p { - font-size: 13px; - color: var(--dark-grey); - margin-top: 2px; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - - img { - width: 20px; - height: 20px; - border-radius: 50%; - overflow: hidden; - object-fit: cover; - object-position: top; - vertical-align: middle; - } - - span { - vertical-align: middle; - margin-left: 3px; - } - } -} diff --git a/src/app/tabs/tabs.component.html b/src/app/tabs/tabs.component.html index cfd388b..a292059 100644 --- a/src/app/tabs/tabs.component.html +++ b/src/app/tabs/tabs.component.html @@ -1,8 +1,8 @@ -
+
-
+
- diff --git a/src/app/welcome/welcome.component.scss b/src/app/welcome/welcome.component.scss index cb9c2bb..4519c52 100644 --- a/src/app/welcome/welcome.component.scss +++ b/src/app/welcome/welcome.component.scss @@ -15,97 +15,6 @@ } } -.subject-list { - position: relative; - width: 80%; - margin: 0 auto; - list-style: none; - - header { - color: var(--black); - - h5 { - font-size: 16px; - margin-top: 30px; - font-weight: 500; - } - - &:first-child { - color: white; - } - } - - li { - background-color: white; - border-radius: 15px; - overflow: hidden; - display: flex; - align-items: center; - padding: 15px 10px; - margin-top: 15px; - box-shadow: 0px 0px 5px -2px var(--black); - justify-content: space-between; - position: relative; - - &::before { - content: ''; - position: absolute; - left: 0; - top: 0; - width: 7px; - height: 100%; - background-color: var(--teal-green); - } - } - - .schedule { - width: 100px; - padding: 0 5px; - text-align: center; - } - - .subject { - width: calc(100% - 100px); - border-left: 1px solid #cecece; - padding-left: 15px; - overflow: hidden; - - p { - margin-top: 10px; - } - } - - label { - font-size: 16px; - color: var(--black); - font-weight: 500; - } - - p { - font-size: 13px; - color: var(--dark-grey); - margin-top: 2px; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - - img { - width: 20px; - height: 20px; - border-radius: 50%; - overflow: hidden; - object-fit: cover; - object-position: top; - vertical-align: middle; - } - - span { - vertical-align: middle; - margin-left: 3px; - } - } -} - .start-button { position: fixed; width: 70%; @@ -120,3 +29,28 @@ border: 0px; z-index: 1; } + + +.card-list-holder { + width: 85%; + margin: 0 auto; + + .card-list { + &:first-child { + header { + color: white; + } + } + } + + header { + color: var(--dark-grey); + position: relative; + + h5 { + font-size: 14px; + margin-top: 30px; + font-weight: 500; + } + } +} diff --git a/src/app/welcome/welcome.component.ts b/src/app/welcome/welcome.component.ts index 829ec96..5b2856b 100644 --- a/src/app/welcome/welcome.component.ts +++ b/src/app/welcome/welcome.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import * as moment from 'moment'; @Component({ selector: 'app-welcome', @@ -6,6 +7,93 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./welcome.component.scss'] }) export class WelcomeComponent implements OnInit { + classList = [{ + date: moment(new Date()).format('MMM, DD 2020'), + classes: [{ + time: '10:00 AM', + duration: '45 Mins', + subject: 'Mathematics', + teacher: { + name: 'Mr Kashinath Kashyap', + profile_image: 'https://pbs.twimg.com/profile_images/3478244961/01ebfc40ecc194a2abc81e82ab877af4.jpeg' + } + }, { + time: '11:00 AM', + duration: '45 Mins', + subject: 'Physics', + teacher: { + name: 'Dr Meghana', + profile_image: 'https://pbs.twimg.com/profile_images/416884752377843712/MW2qg7-f.jpeg' + } + }, { + time: '12:00 PM', + duration: '45 Mins', + subject: 'Chemistry', + teacher: { + name: 'Mr Kashinath Kashyap', + profile_image: 'https://pbs.twimg.com/profile_images/3478244961/01ebfc40ecc194a2abc81e82ab877af4.jpeg' + } + }, { + time: '2:00 PM', + duration: '45 Mins', + subject: 'EVS', + teacher: { + name: 'Mr Kashinath Kashyap', + profile_image: 'https://pbs.twimg.com/profile_images/3478244961/01ebfc40ecc194a2abc81e82ab877af4.jpeg' + } + }, { + time: '3:00 PM', + duration: '45 Mins', + subject: 'Biology', + teacher: { + name: 'Dr Meghana', + profile_image: 'https://pbs.twimg.com/profile_images/416884752377843712/MW2qg7-f.jpeg' + } + }] + }, { + date: moment(new Date()).subtract(1, 'day').format('MMM, DD 2020'), + classes: [{ + time: '10:00 AM', + duration: '45 Mins', + subject: 'Mathematics', + teacher: { + name: 'Mr Kashinath Kashyap', + profile_image: 'https://pbs.twimg.com/profile_images/3478244961/01ebfc40ecc194a2abc81e82ab877af4.jpeg' + } + }, { + time: '11:00 AM', + duration: '45 Mins', + subject: 'Physics', + teacher: { + name: 'Dr Meghana', + profile_image: 'https://pbs.twimg.com/profile_images/416884752377843712/MW2qg7-f.jpeg' + } + }, { + time: '12:00 PM', + duration: '45 Mins', + subject: 'Chemistry', + teacher: { + name: 'Mr Kashinath Kashyap', + profile_image: 'https://pbs.twimg.com/profile_images/3478244961/01ebfc40ecc194a2abc81e82ab877af4.jpeg' + } + }, { + time: '2:00 PM', + duration: '45 Mins', + subject: 'EVS', + teacher: { + name: 'Mr Kashinath Kashyap', + profile_image: 'https://pbs.twimg.com/profile_images/3478244961/01ebfc40ecc194a2abc81e82ab877af4.jpeg' + } + }, { + time: '3:00 PM', + duration: '45 Mins', + subject: 'Biology', + teacher: { + name: 'Dr Meghana', + profile_image: 'https://pbs.twimg.com/profile_images/416884752377843712/MW2qg7-f.jpeg' + } + }] + }] constructor() { }