-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from IanKBovard/tests
Tests
- Loading branch information
Showing
14 changed files
with
319 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2016 The Polymer Project Authors. All rights reserved. | ||
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
* Code distributed by Google as part of the polymer project is also | ||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
*/ | ||
|
||
// This component is responsible for rendering the Cover, ISBN, and Authors of the book. Data is passed into this component from the main book view component index.js | ||
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js'; | ||
import '@polymer/iron-image/iron-image.js'; | ||
|
||
class BookDescription extends PolymerElement { | ||
static get template() { | ||
return html` | ||
<style> | ||
:host { | ||
margin-left: 1%; | ||
margin-right: 1%; | ||
float: left; | ||
} | ||
iron-image { | ||
border-radius: 5px; | ||
} | ||
.book-details { | ||
font-family: Aspira-Bold, Helvetica, Arial, Sans-serif; | ||
color: #000; | ||
font-size: 12px | ||
} | ||
.meta-desc { | ||
font-weight: Bold; | ||
} | ||
</style> | ||
<div> | ||
<iron-image src="https://d1re4mvb3lawey.cloudfront.net/pg1017/cover.jpg"></iron-image> | ||
<div class="book-details"> | ||
<span class="meta-desc">ISBN:</span> | ||
<span class=meta-data>{{isbn}}</span> | ||
</div> | ||
<div class="book-details"> | ||
<template is="dom-repeat" items="[[authors]]"> | ||
<span class="meta-desc">Authors:</span> | ||
<span class="meta-data">{{item}}</span> | ||
</template> | ||
</div> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
window.customElements.define('book-description', BookDescription); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js'; | ||
import '@polymer/iron-ajax/iron-ajax.js'; | ||
import'./book-description.js'; | ||
import'./table-of-contents.js'; | ||
import'./book-title.js'; | ||
|
||
|
||
//This is the main book view component. It is responsible for making the AJAX request and passing relevent data to each component. | ||
class BookView extends PolymerElement { | ||
static get template() { | ||
return html` | ||
<style> | ||
:host { | ||
} | ||
.book-data { | ||
width: 100%; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
} | ||
</style> | ||
<iron-ajax | ||
auto | ||
url="https://d1re4mvb3lawey.cloudfront.net/pg1017/index.json" | ||
handle-as="json" | ||
on-response="handleResponse"> | ||
</iron-ajax> | ||
<div class="book-data"> | ||
<book-title title="{{bookData.title}}"> | ||
</book-title> | ||
<book-description isbn="{{bookData.isbn}}" authors="{{bookData.contributors}}"> | ||
</book-description> | ||
<table-of-contents toc="{{bookData.toc}}"> | ||
</table-of-contents> | ||
</div> | ||
`; | ||
} | ||
handleResponse(res){ | ||
this.bookData = res.detail.response | ||
console.log(this.bookData.toc) | ||
return | ||
} | ||
constructor() { | ||
super(); | ||
this.bookData = {} | ||
} | ||
} | ||
|
||
window.customElements.define('book-view', BookView); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2016 The Polymer Project Authors. All rights reserved. | ||
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
* Code distributed by Google as part of the polymer project is also | ||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
*/ | ||
|
||
// This component is responsible for rendering the Table of Contents. Data is passed into this component from the main book view component index.js | ||
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js'; | ||
|
||
class TableOfContents extends PolymerElement { | ||
static get template() { | ||
return html` | ||
<style> | ||
:host { | ||
} | ||
.toc-container { | ||
position: relative; | ||
display: inline-block; | ||
width: 500px; | ||
height: 252px; | ||
font-family: Aspira-Bold, Helvetica, Arial, Sans-serif; | ||
color: #000; | ||
} | ||
.toc-text { | ||
font-weight: bold; | ||
font-size: 18px; | ||
position: relative; | ||
display: inline-block; | ||
padding-left: 20px; | ||
padding-top: 20px; | ||
} | ||
.toc-content { | ||
position: relative; | ||
padding-left: 30px; | ||
white-space: nowrap; | ||
} | ||
ol { | ||
display: block; | ||
list-style-type: decimal; | ||
} | ||
li { | ||
display: list-item; | ||
} | ||
a { | ||
color: inherit; | ||
text-decoration: none; | ||
} | ||
a:hover { | ||
background-color: #FFD700; | ||
} | ||
</style> | ||
<div class="toc-container"> | ||
<span class="toc-text">Contents</span> | ||
<div class="toc-content"> | ||
<ol> | ||
<template is="dom-repeat" items="[[toc]]"> | ||
<li> | ||
<a href="{{item.file}}">Title should go here</a> | ||
</li> | ||
</template> | ||
</ol> | ||
</div> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
window.customElements.define('table-of-contents', TableOfContents); | ||
|
||
// NOTES | ||
|
||
// The title property for the table of contents is an empty string. If it were not, between the a tag where the string "Title should go here" I would put {{item.title}} | ||
|
||
// Links do not work, but are using the correct property item.file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.