From e493dca870fdabbf29e611dc12921afcdb9bf085 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 21 Feb 2019 21:57:28 +0000 Subject: Moved to outside directory - redoing seperation of concerns --- Frontend/css/main.css | 32 +++++++++++++++++++++++++++++ Frontend/index.html | 18 ++++++++++++++++ Frontend/scripts/main.ts | 49 ++++++++++++++++++++++++++++++++++++++++++++ Frontend/tsconfig.json | 8 ++++++++ Main/wwwroot/css/main.css | 32 ----------------------------- Main/wwwroot/index.html | 18 ---------------- Main/wwwroot/scripts/main.ts | 49 -------------------------------------------- Main/wwwroot/tsconfig.json | 8 -------- 8 files changed, 107 insertions(+), 107 deletions(-) create mode 100644 Frontend/css/main.css create mode 100644 Frontend/index.html create mode 100644 Frontend/scripts/main.ts create mode 100644 Frontend/tsconfig.json delete mode 100644 Main/wwwroot/css/main.css delete mode 100644 Main/wwwroot/index.html delete mode 100644 Main/wwwroot/scripts/main.ts delete mode 100644 Main/wwwroot/tsconfig.json diff --git a/Frontend/css/main.css b/Frontend/css/main.css new file mode 100644 index 0000000..ca052da --- /dev/null +++ b/Frontend/css/main.css @@ -0,0 +1,32 @@ +* { + --size: 20em; + /*Image size*/ +} + +#root { + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-template-rows: repeat(20, 1fr); + grid-gap: 2em; +} + +.Frame { + outline: grey 0.5em auto; +} + +.Frame h1 { + display: inline; + align-content: center; + font-family: 'Poppins', sans-serif; +} + +.Frame a:link, +.Frame a:visited { + color: black; +} + +.Frame img { + display: block; + background-size: cover; + width: 38em; +} \ No newline at end of file diff --git a/Frontend/index.html b/Frontend/index.html new file mode 100644 index 0000000..d2721dc --- /dev/null +++ b/Frontend/index.html @@ -0,0 +1,18 @@ + + + + + + + Page Title + + + + + + +
+ + + + \ No newline at end of file diff --git a/Frontend/scripts/main.ts b/Frontend/scripts/main.ts new file mode 100644 index 0000000..e68bc97 --- /dev/null +++ b/Frontend/scripts/main.ts @@ -0,0 +1,49 @@ +class Article { + Container: HTMLElement; + Title: HTMLElement; + Image: HTMLElement; + + constructor(title: string, description: string, article_link: string, image_link: string) { + // object initialisation + this.Container = document.createElement('div'); + this.Title = document.createElement('h1'); + this.Image = new Image(); + let link = document.createElement('a'); + + // attributes + link.innerText = title; + link.setAttribute('href', article_link); + this.Image.setAttribute('src', image_link); + this.Image.setAttribute('title', description); + this.Container.className = "Frame"; + + // make unit + this.Title.appendChild(link); + this.Container.appendChild(this.Title); + this.Container.appendChild(this.Image); + } + + visualise(root: HTMLElement): void { + // visualise the article for document + root.appendChild(this.Container); + } +} + +let root = document.getElementById('root'); + +let title = "Amazon reconsiders building new headquarters in New York City: WaPo"; +let description = "Description"; +let article = "https://www.wikipedia.org/"; +let image = "https://s.abcnews.com/images/Business/long-island-city-gty-jc-181112_hpMain_4x3t_384.jpg"; + +let articles: Array
= [ + new Article(title, description, article, image), + new Article(title, description, article, image), + new Article(title, description, article, image), + new Article(title, description, article, image), + new Article(title, description, article, image), + new Article(title, description, article, image), + new Article(title, description, article, image) +]; + +articles.forEach(article => article.visualise(root)); diff --git a/Frontend/tsconfig.json b/Frontend/tsconfig.json new file mode 100644 index 0000000..89d01c4 --- /dev/null +++ b/Frontend/tsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "esnext", + "sourceMap": true, + "outDir": "js/" + } +} \ No newline at end of file diff --git a/Main/wwwroot/css/main.css b/Main/wwwroot/css/main.css deleted file mode 100644 index ca052da..0000000 --- a/Main/wwwroot/css/main.css +++ /dev/null @@ -1,32 +0,0 @@ -* { - --size: 20em; - /*Image size*/ -} - -#root { - display: grid; - grid-template-columns: repeat(3, 1fr); - grid-template-rows: repeat(20, 1fr); - grid-gap: 2em; -} - -.Frame { - outline: grey 0.5em auto; -} - -.Frame h1 { - display: inline; - align-content: center; - font-family: 'Poppins', sans-serif; -} - -.Frame a:link, -.Frame a:visited { - color: black; -} - -.Frame img { - display: block; - background-size: cover; - width: 38em; -} \ No newline at end of file diff --git a/Main/wwwroot/index.html b/Main/wwwroot/index.html deleted file mode 100644 index d2721dc..0000000 --- a/Main/wwwroot/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - Page Title - - - - - - -
- - - - \ No newline at end of file diff --git a/Main/wwwroot/scripts/main.ts b/Main/wwwroot/scripts/main.ts deleted file mode 100644 index e68bc97..0000000 --- a/Main/wwwroot/scripts/main.ts +++ /dev/null @@ -1,49 +0,0 @@ -class Article { - Container: HTMLElement; - Title: HTMLElement; - Image: HTMLElement; - - constructor(title: string, description: string, article_link: string, image_link: string) { - // object initialisation - this.Container = document.createElement('div'); - this.Title = document.createElement('h1'); - this.Image = new Image(); - let link = document.createElement('a'); - - // attributes - link.innerText = title; - link.setAttribute('href', article_link); - this.Image.setAttribute('src', image_link); - this.Image.setAttribute('title', description); - this.Container.className = "Frame"; - - // make unit - this.Title.appendChild(link); - this.Container.appendChild(this.Title); - this.Container.appendChild(this.Image); - } - - visualise(root: HTMLElement): void { - // visualise the article for document - root.appendChild(this.Container); - } -} - -let root = document.getElementById('root'); - -let title = "Amazon reconsiders building new headquarters in New York City: WaPo"; -let description = "Description"; -let article = "https://www.wikipedia.org/"; -let image = "https://s.abcnews.com/images/Business/long-island-city-gty-jc-181112_hpMain_4x3t_384.jpg"; - -let articles: Array
= [ - new Article(title, description, article, image), - new Article(title, description, article, image), - new Article(title, description, article, image), - new Article(title, description, article, image), - new Article(title, description, article, image), - new Article(title, description, article, image), - new Article(title, description, article, image) -]; - -articles.forEach(article => article.visualise(root)); diff --git a/Main/wwwroot/tsconfig.json b/Main/wwwroot/tsconfig.json deleted file mode 100644 index 89d01c4..0000000 --- a/Main/wwwroot/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "esnext", - "sourceMap": true, - "outDir": "js/" - } -} \ No newline at end of file -- cgit v1.2.3-13-gbd6f