-
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 #39 from AGenCyLab/feat/news
feat: news pages and gallery updates
- Loading branch information
Showing
23 changed files
with
760 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
.news-container { | ||
padding-bottom: 24px; | ||
} | ||
|
||
.news-image-container { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.news-image { | ||
width: auto; | ||
height: 50vh; | ||
object-fit: cover; | ||
margin-bottom: 16px; | ||
} | ||
|
||
.news-image-caption { | ||
font-weight: bold; | ||
font-size: 1.2em; | ||
margin: 8px 0; | ||
} | ||
|
||
.news-body { | ||
margin-top: 8px; | ||
font-size: 1.3em; | ||
line-height: 1.2em; | ||
} | ||
|
||
.news-date-container { | ||
display: flex; | ||
align-items: center; | ||
margin: 8px 0; | ||
} | ||
|
||
.news-date-container p { | ||
margin: 0; | ||
padding: 0; | ||
font-weight: bold; | ||
font-size: 1.3em; | ||
} | ||
|
||
.news-date-container i { | ||
font-size: 1.3em; | ||
padding: 0 8px 0 0; | ||
} | ||
|
||
.copy-news-link-button { | ||
background-color: #2e2e2e; | ||
color: #eee; | ||
padding: 8px 16px; | ||
border-radius: 2em; | ||
margin-bottom: 8px; | ||
} | ||
|
||
.copy-news-link-button:disabled, | ||
.copy-news-link-button[disabled="disabled"] { | ||
background-color: rgb(0, 156, 60); | ||
color: #fff; | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
const newsDetailsTemplate = document.createElement("template"); | ||
newsDetailsTemplate.innerHTML = ` | ||
<link href="/css/theme.css" rel="stylesheet" /> | ||
<link href="/css/news-details-style.css" rel="stylesheet" /> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" | ||
integrity="sha512-SfTiTlX6kk+qitfevl/7LibUOeJWlt9rbyDn92a1DqWOw9vWG2MFoays0sgObmWazO5BQPiFucnnEAjpAB+/Sw==" | ||
crossorigin="anonymous" | ||
referrerpolicy="no-referrer" | ||
></link> | ||
<div class="news-container"> | ||
<h1 class="news-title"> | ||
<slot name="news-title"></slot> | ||
</h1> | ||
<div class="news-date-container"> | ||
<i class="fa fa-calendar-o" aria-hidden="true"></i> | ||
<p class="news-date"> | ||
<slot name="news-date"></slot> | ||
</p> | ||
</div> | ||
<button class="copy-news-link-button">Share News Link</button> | ||
<div class="news-image-container"> | ||
<slot name="news-image"></slot> | ||
<em class="news-image-caption"> | ||
<slot name="news-image-caption"> | ||
</slot> | ||
</em> | ||
</div> | ||
<p class="news-body"> | ||
<slot name="news-body"></slot> | ||
</p> | ||
</div> | ||
`; | ||
|
||
class NewsDetails extends HTMLElement { | ||
constructor() { | ||
super(); | ||
this.attachShadow({ mode: "open" }); | ||
this.shadowRoot.appendChild(newsDetailsTemplate.content.cloneNode(true)); | ||
} | ||
|
||
setNewsDate(date) { | ||
if (date) { | ||
const dateNode = this.shadowRoot.querySelector(".news-date"); | ||
dateNode.innerHTML = formatDate(date); | ||
} | ||
} | ||
|
||
connectedCallback() { | ||
const newsDate = this.getAttribute("date"); | ||
this.setNewsDate(newsDate); | ||
|
||
const copyNewsLinkButton = this.shadowRoot.querySelector( | ||
".copy-news-link-button" | ||
); | ||
|
||
copyNewsLinkButton.addEventListener("click", function (event) { | ||
navigator.clipboard.writeText(window.location.href); | ||
copyNewsLinkButton.innerHTML = "Link Copied!"; | ||
copyNewsLinkButton.disabled = true; | ||
|
||
setTimeout(() => { | ||
copyNewsLinkButton.innerHTML = "Share News Link"; | ||
copyNewsLinkButton.disabled = false; | ||
}, 10 * 1000); | ||
}); | ||
} | ||
} | ||
|
||
window.customElements.define("news-details", NewsDetails); |
Oops, something went wrong.