Skip to content

Commit

Permalink
[TRA-1517] Update internal linking (toptal#533)
Browse files Browse the repository at this point in the history
* TRA-1517 Update internal linking

* Cleanup internalLinkingController

* Fix files formatting
  • Loading branch information
Maciek Caputa authored May 31, 2021
1 parent ee06c6b commit 086eb17
Show file tree
Hide file tree
Showing 11 changed files with 552 additions and 19 deletions.
103 changes: 103 additions & 0 deletions Public/css/app.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,101 @@
.internal-linking {
border: 0;
width: 100vw;
height: 56px;
overflow: hidden;
flex-shrink: 0;
flex-basis: 56px;
}
@media (max-width: 768px) {
.internal-linking {
height: 32px;
flex-basis: 32px;
}
}
@keyframes ticker {
0% {
transform: translateX(0%);
}
100% {
transform: translateX(-50%);
}
}
.internal-linking__container {
font-weight: 400;
font-family: Proxima Nova, Arial, sans-serif;
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
height: 56px;
overflow: hidden;
color: #ffffff;
background-color: #0f256e;
}
.internal-linking__container .internal-linking__title {
z-index: 1;
display: flex;
flex-direction: row;
flex-shrink: 0;
align-items: center;
height: 100%;
color: #204ecf;
font-weight: 600;
font-size: 10px;
line-height: 12px;
text-transform: uppercase;
background-color: #ffffff;
}
.internal-linking__container .internal-linking__title img {
margin: 22px 8px 18px 24px;
}
.internal-linking__container .internal-linking__title span {
margin: 16px 24px 16px 0;
white-space: nowrap;
}
.internal-linking__container .internal-linking__ticker-list {
display: flex;
flex-direction: row;
font-size: 12px;
line-height: 16px;
animation-name: ticker;
animation-duration: 180s;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
.internal-linking__container .internal-linking__ticker-list:hover {
animation-play-state: paused;
}
.internal-linking__container .internal-linking__ticker-list .internal-linking__link {
margin: 20px 28px;
padding: 5px 12px 3px 12px;
color: #ffffff;
white-space: nowrap;
text-decoration: underline;
}
@media screen and (max-width: 768px) {
.internal-linking__container {
height: 32px;
border: none;
box-shadow: none;
}
.internal-linking__container .internal-linking__title img {
margin: 8px;
}
.internal-linking__container .internal-linking__title span {
margin: 6px 16px 6px 0;
font-size: 8px;
line-height: 10px;
}
}
@media (max-width: 768px) {
.internal-linking__container .internal-linking__ticker-list .internal-linking__link {
margin: 4px 16px;
text-decoration: none;
border: 1px solid #ffffff;
border-radius: 16px;
}
}
@font-face {
font-display: swap;
font-weight: 100;
Expand Down Expand Up @@ -136,6 +234,11 @@ main .masthead-top {
margin-top: 180px;
}
}
@media (max-width: 320px) {
main .masthead-top {
margin-top: 42px;
}
}
main .masthead-top img {
width: 100%;
max-width: 370px;
Expand Down
5 changes: 5 additions & 0 deletions Public/css/app.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import "variables.less";
@import "internal-linking.less";

@font-face {
font-display: swap;
Expand Down Expand Up @@ -164,6 +165,10 @@ main {
margin-top: 180px;
}

@media(max-width: 320px) {
margin-top: 42px;
}

img {
width: 100%;
max-width: 370px;
Expand Down
115 changes: 115 additions & 0 deletions Public/css/internal-linking.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
.internal-linking {
border: 0;
width: 100vw;
height: @internalLinkingHeightDesktop;
overflow: hidden;
flex-shrink: 0;
flex-basis: @internalLinkingHeightDesktop;
@media (max-width: 768px) {
height: @internalLinkingHeightMobile;
flex-basis: @internalLinkingHeightMobile;
}
}

@keyframes ticker {
0% {
transform: translateX(0%);
}

100% {
transform: translateX(-50%);
}
}

.internal-linking__container {
font-weight: 400;
font-family: Proxima Nova, Arial, sans-serif;
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
height: 56px;
overflow: hidden;
color: @white;
background-color: @darkBlue;

.internal-linking__title {
z-index: 1;
display: flex;
flex-direction: row;
flex-shrink: 0;
align-items: center;
height: 100%;
color: @blue;
font-weight: 600;
font-size: 10px;
line-height: 12px;
text-transform: uppercase;
background-color: @white;

img {
margin: 22px 8px 18px 24px;
}

span {
margin: 16px 24px 16px 0;
white-space: nowrap;
}
}

.internal-linking__ticker-list {
display: flex;
flex-direction: row;
font-size: 12px;
line-height: 16px;
animation-name: ticker;
animation-duration: 180s;
animation-timing-function: linear;
animation-iteration-count: infinite;

&:hover {
animation-play-state: paused;
}

.internal-linking__link {
margin: 20px 28px;
padding: 5px 12px 3px 12px;
color: @white;
white-space: nowrap;
text-decoration: underline;
}
}
}

@media screen and (max-width: 768px) {
.internal-linking__container {
height: 32px;
border: none;
box-shadow: none;

.internal-linking__title {
img {
margin: 8px;
}

span {
margin: 6px 16px 6px 0;
font-size: 8px;
line-height: 10px;
}
}
}
}

@media (max-width: 768px) {
.internal-linking__container {
.internal-linking__ticker-list {
.internal-linking__link {
margin: 4px 16px;
text-decoration: none;
border: 1px solid @white;
border-radius: 16px;
}
}
}
}
5 changes: 5 additions & 0 deletions Public/css/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@darkgray: #455065;
@gray: #a6abb5;
@lightgray: #d8d9dc;
@darkBlue: #0f256e;

// fonts
@weight-thin: 100;
Expand Down Expand Up @@ -54,3 +55,7 @@
@tag-border-color: @lightgray;
@tag-remove-color: @darkgray;
@tag-remove-color-hover: @gray;

// internal-linking
@internalLinkingHeightDesktop: 56px;
@internalLinkingHeightMobile: 32px;
2 changes: 1 addition & 1 deletion Resources/Views/index.leaf
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
</div>
</div>
</main>
<iframe id="internal-linking" src="/internal-linking?site=GitIgnore"></iframe>
#embed("internal-linking")
</div>

<!-- Footer Scripts -->
Expand Down
44 changes: 44 additions & 0 deletions Resources/Views/internal-linking.leaf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<div class="internal-linking">
<div class="internal-linking__container">
<div class="internal-linking__title">
<img src="https://frontier-assets.toptal.com/ec99a6ba6efa2bbb78f99a929026b33d.svg" />
<span>
Skills in High Demand
<br />
by Toptal Clients
</span>
</div>
<div class="internal-linking__ticker-list">
#for(link in links.links) {
<a
href="#(link.url)"
data-ga-category="inbound-link"
data-ga-event="#(link.title)"
data-ga-label="GitIgnore"
target="_blank"
rel="noopener"
class="internal-linking__link"
>
#(link.title)
</a>
}
</div>
</div>
</div>
<script>

var handleOnClick = function handleOnClick(e) {
if (!('gtag' in window)) return;
window.gtag('event', e.target.dataset.gaEvent, {
event_category: e.target.dataset.gaCategory,
event_label: e.target.dataset.gaLabel,
non_interaction: true
});
};

document.querySelectorAll('.internal-linking__link').forEach(function (item) {
item.addEventListener('click', handleOnClick);
item.addEventListener('auxclick', handleOnClick);
});

</script>
Loading

0 comments on commit 086eb17

Please sign in to comment.