-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(gh-pages): newsline section #1731
Merged
Merged
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e0e3f51
docs(gh-pages): news section
fshovchko a89caa8
chore(gh-pages): news section refactoring
fshovchko 0479359
chore(gh-pages): news section refactoring
fshovchko 9d6b205
chore(gh-pages): news section refactoring
fshovchko 8840f34
Merge branch 'main' into docs/news-section
fshovchko 7b13f49
chore(gh-pages): news section refactoring
fshovchko 6495d18
Merge branch 'docs/news-section' of https://github.com/exadel-inc/esl…
fshovchko fec20aa
chore(gh-pages): remove debug log
fshovchko 561a184
chore(gh-pages): remove truncate method
fshovchko 758994b
chore(gh-pages): news section refactoring
fshovchko 406098f
chore(gh-pages): update date semantics
fshovchko d758413
chore(gh-pages): fix date formatter localization
ala-n cfe07d9
chore(gh-pages): fix indexing of the 11ty watch
ala-n 00d8636
chore(gh-pages): rework the Newsline component
ala-n e355303
Merge branch 'main' of github.com:exadel-inc/esl into docs/news-section
ala-n 6afbf9e
docs(gh-pages): "contribute to documentation" note
ala-n fe7a86d
chore(gh-pages): fix mobile version of newline component
ala-n 15cb7f8
chore(gh-pages): fix filters to properly handle empty collections + a…
ala-n 9180770
docs(gh-pages): replace content with a more realistic one
ala-n c8dbcb3
chore(gh-pages): simplify `createSortFilter` function
ala-n a0267e9
chore(gh-pages): small corrections for rendering utils
ala-n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,6 @@ | ||
const date = (timestamp) => | ||
new Intl.DateTimeFormat('en-GB', { timeZone: 'UTC', month: 'long', day: '2-digit', year: 'numeric' }).format(new Date(timestamp)); | ||
|
||
module.exports = (config) => { | ||
config.addFilter('date', date); | ||
}; |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module.exports = (config) => { | ||
/** Filter items by hidden marker */ | ||
const notHiddenFilter = (collection) => collection.filter( item => !item.data.hidden ); | ||
const notHiddenFilter = (collection) => (collection || []).filter( item => !item.data.hidden ); | ||
|
||
config.addFilter('notHidden', notHiddenFilter); | ||
}; |
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 |
---|---|---|
@@ -1,24 +1,31 @@ | ||
module.exports = (config) => { | ||
/** Generic sort njk filter */ | ||
const sortFilter = (comparer) => (values) => { | ||
if (!values || !Array.isArray(values)) { | ||
const createSortFilter = (comparer) => (values) => { | ||
if (!Array.isArray(values)) { | ||
console.error(`Unexpected values for sort filter: ${values}`); | ||
return values; | ||
} | ||
return [...values].sort(comparer); | ||
}; | ||
|
||
// Utils | ||
const resoleDate = (item) => new Date(item.date).getTime(); | ||
const resoleDateStrict = (item) => item.data.date ? new Date(item.date).getTime() : Number.POSITIVE_INFINITY; | ||
|
||
/** Comparer composer */ | ||
const compose = (cmpA, cmpB) => (a, b) => cmpA(a, b) || cmpB(a, b); | ||
const compose = (...cmps) => (a, b) => cmps.reduce((res, cmp) => res || cmp(a, b), 0); | ||
|
||
/** Name metadata comparer */ | ||
const nameComparer = (a, b) => a.data.name.localeCompare(b.data.name); | ||
/** Order metadata comparer */ | ||
const orderComparer = (a, b) => (a.data.order || 0) - (b.data.order || 0); | ||
/** Date metadata comparer */ | ||
const dateComparer = (a, b) => new Date(b.date).getTime() - new Date(a.date).getTime(); | ||
const dateComparer = (a, b) => resoleDate(a) - resoleDate(b); | ||
/** Date metadata comparer (will not use file creation date) */ | ||
const dateComparerStrict = (a, b) => resoleDateStrict(a) - resoleDateStrict(b); | ||
|
||
config.addFilter('sortByName', sortFilter(nameComparer)); | ||
config.addFilter('sortByNameAndOrder', sortFilter(compose(orderComparer, nameComparer))); | ||
config.addFilter('sortByDate', sortFilter(dateComparer)); | ||
config.addFilter('sortByName', createSortFilter(nameComparer)); | ||
config.addFilter('sortByNameAndOrder', createSortFilter(compose(orderComparer, nameComparer))); | ||
config.addFilter('sortByDate', createSortFilter(dateComparer)); | ||
config.addFilter('sortByDateStrict', createSortFilter(dateComparerStrict)); | ||
}; |
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
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,101 @@ | ||
@import (reference) "../../common/variables.less"; | ||
|
||
.newsline { | ||
position: relative; | ||
margin: 0 auto 10rem; | ||
|
||
&-list { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
&-item { | ||
position: relative; | ||
list-style: none; | ||
} | ||
|
||
&-link { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
z-index: 1; | ||
} | ||
|
||
&-content { | ||
padding: 1.5rem 1rem 1.5rem 3rem; | ||
@media @sm-xl { | ||
padding: 1.5rem 5rem; | ||
} | ||
|
||
color: white; | ||
border-left: 3px solid white; | ||
transition: border-color .25s ease-in-out; | ||
|
||
&::before { | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-image: linear-gradient(to right, fade(@nav-dark-selected, 25%), fade(@nav-dark-selected, 0%)); | ||
pointer-events: none; | ||
opacity: 0; | ||
transition: opacity .25s ease-in-out; | ||
} | ||
|
||
& &-title { | ||
font-size: 1.5rem; | ||
margin-left: -1px; | ||
margin-bottom: 1rem; | ||
} | ||
& &-emoji { | ||
position: absolute; | ||
transform: translateX(-100%); | ||
margin-left: -.4rem; | ||
@media @sm-xl { | ||
margin-left: -.8rem; | ||
} | ||
} | ||
& &-date { | ||
display: block; | ||
font-size: .85rem; | ||
margin-top: .4rem; | ||
opacity: .75; | ||
} | ||
|
||
& &-text { | ||
font-size: 1rem; | ||
|
||
a[href] { | ||
position: relative; | ||
z-index: 2; | ||
} | ||
|
||
// h1-h3 are not allowed in content of the newsline | ||
h1, h2, h3 { display: none; } | ||
|
||
h4, .h4 { | ||
font-size: 1.2rem; | ||
} | ||
h5, .h5 { | ||
font-size: 1.1rem; | ||
} | ||
p { | ||
margin-bottom: .2rem; | ||
} | ||
} | ||
} | ||
|
||
&-item-highlighted &-content { | ||
color: #fbf9a2; | ||
border-color: #fbf9a2; | ||
} | ||
|
||
&-item &-link:hover + &-content { | ||
border-color: @nav-dark-accent; | ||
&::before { opacity: 1; } | ||
} | ||
} |
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,34 @@ | ||
{% set releasedNews = collections.news | released | sortByDateStrict | reverse %} | ||
{% if releasedNews.length %} | ||
<div class="newsline container"> | ||
<h2>{{ landing.news.title }}</h2> | ||
<ul class="newsline-list"> | ||
{% for item in releasedNews | limit(3) %} | ||
{% set isArticle = [].concat(item.data.tags).includes('blogs') %} | ||
{% set isHighlighted = [].concat(item.data.tags).includes('highlight') %} | ||
|
||
<li class="esl-animate-slide up newsline-item {{ 'newsline-item-highlighted' if isHighlighted }}" | ||
esl-animate="{group: true}"> | ||
{% if item.data.link or isArticle %} | ||
<a class="newsline-link" | ||
aria-describedby="newsline-item-{{ loop.index }}" | ||
href="{{ item.data.link or (item.url | url) }}"></a> | ||
{% endif %} | ||
<div id="newsline-item-{{ loop.index }}" class="newsline-content"> | ||
<h3 class="newsline-content-title"><span class="newsline-content-emoji" aria-hidden="true">{{ item.data.emoji }}</span>{{ item.data.title or item.data.name }}</h3> | ||
|
||
{% if isArticle %} | ||
<div class="newsline-content-text markdown-container">{{ item.templateContent | text | truncate(250) }}</div> | ||
{% else %} | ||
<div class="newsline-content-text markdown-container">{{ item.templateContent | safe }}</div> | ||
{% endif %} | ||
|
||
{% if item.data.date %} | ||
<time class="newsline-content-date" datetime="{{ item.date.toISOString() }}">{{ item.date | date }}</time> | ||
{% endif %} | ||
</div> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
{% endif %} |
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,9 @@ | ||
--- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note for reviewers: that one is not a stub. So feel free to make notes regarding content |
||
name: Documentation | ||
title: Contribute to ESL documentation | ||
tags: [highlight, news] | ||
emoji: 💙 | ||
--- | ||
|
||
Found a typo? Have an interesting usage example to share? Want to help improve our documentation? | ||
You are very welcome to contribute to ESL. Check out our [documentation contribution guide](../introduction/index.njk). |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposition. Add this color to
colors.less
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be done separately with the final cleanup on the
epic/redesign
branch