Skip to content

Commit 3570dbd

Browse files
committed
feat: Added announcement ribbon functionality on a page level
1 parent a67d7ec commit 3570dbd

File tree

5 files changed

+62
-120
lines changed

5 files changed

+62
-120
lines changed

_assets/css/_styles.scss

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,37 @@ nav.TK-Nav, .PRGS-PairNav {
337337
margin-top: -95px;
338338
}
339339

340+
// Ribbon Announcement
341+
342+
.SiteRibbon-text,
343+
.SiteRibbon-CTA {
344+
display: inline;
345+
vertical-align: middle;
346+
}
347+
348+
.SiteRibbon {
349+
margin-top: -95px;
350+
top: 0;
351+
position: relative;
352+
padding: 20px 0 18px 0;
353+
font-family: FaktSlabPro,Arial,Helvetica,sans-serif;
354+
font-weight: 300;
355+
font-size: 16px;
356+
line-height: 1.2;
357+
text-align: center;
358+
z-index: 50000;
359+
color: #000;
360+
background-color: #ffda3f;
361+
362+
.container {
363+
position: relative;
364+
}
365+
366+
+ nav.TK-Nav, + .PRGS-PairNav {
367+
margin-top: 0;
368+
}
369+
}
370+
340371
/* Main Menu */
341372

342373
$text-color: #4a4e52;
@@ -2708,6 +2739,10 @@ $callout-bg: #d7dfe3;
27082739

27092740
// md size
27102741
@media (min-width: 992px) {
2742+
.SiteRibbon {
2743+
font-size: 20px;
2744+
}
2745+
27112746
.live-samples .callout-tabs {
27122747
&::after {
27132748
display: none;
@@ -3197,6 +3232,14 @@ span.all-components-expanded-icon {
31973232
transform: translateZ(0);
31983233
-webkit-transform: translateZ(0);
31993234
}
3235+
3236+
.SiteRibbon {
3237+
position: sticky;
3238+
3239+
+ nav.TK-Nav, + .PRGS-PairNav {
3240+
top: 24px;
3241+
}
3242+
}
32003243
}
32013244

32023245
@media (min-width: 768px) { /* Styles for width >= 768px */
@@ -4631,23 +4674,24 @@ div#sidetoc {
46314674
}
46324675
}
46334676

4634-
div{
4635-
&.k-content {
4636-
&.k-state-active{
4637-
.copy-code-btn {
4638-
padding:7px 10px;
4639-
}
4677+
div {
4678+
&.k-content {
4679+
&.k-state-active {
4680+
.copy-code-btn {
4681+
padding: 7px 10px;
4682+
}
4683+
}
46404684
}
4641-
}
46424685
}
4686+
46434687
.copy-code-btn {
46444688
position: absolute;
46454689
top: 0;
46464690
right: 0;
4647-
padding:10px;
4691+
padding: 10px;
46484692
z-index: 100;
46494693

46504694
&:hover {
4651-
cursor: pointer;
4695+
cursor: pointer;
46524696
}
46534697
}

_assets/js/ribbon.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

_assets/js/side-nav.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function setSideNavPosition() {
8787
var $window = $(window);
8888
var windowHeight = $window.height();
8989
var scrollFold = $window.scrollTop() + windowHeight;
90-
var topNavigationHeight = $('nav.TK-Nav').height() || ($('.PRGS-Nav').height() + $('.PRGS-Bar').height());
90+
var topNavigationHeight = $('.SiteRibbon').outerHeight() + ($('nav.TK-Nav').height() || ($('.PRGS-Nav').height() + $('.PRGS-Bar').height()));
9191
var progressBarHeight = $('aside.TK-Hat').height() || $('.PRGS-Bar').height();
9292

9393
var top = window.scrollY > 0 ? topNavigationHeight - progressBarHeight : topNavigationHeight;

_includes/announcement.html

Lines changed: 7 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,9 @@
1-
<style>
2-
.SiteRibbon {
3-
position: relative;
4-
padding: 20px 0 18px 0;
5-
font-family: FaktSlabPro,Arial,Helvetica,sans-serif;
6-
font-weight: 300;
7-
font-size: 16px;
8-
line-height: 1.2;
9-
text-align: center;
10-
color: #000;
11-
background-color: #ffda3f;
12-
}
13-
14-
.SiteRibbon.is-hidden {
15-
display: none;
16-
}
17-
18-
.SiteRibbon .container {
19-
position: relative;
20-
}
21-
.SiteRibbon-text,
22-
.SiteRibbon-CTA {
23-
display: inline-block;
24-
vertical-align: middle;
25-
}
26-
27-
.SiteRibbon-CTA a {
28-
cursor: pointer;
29-
}
30-
31-
.SiteRibbon-x {
32-
position: absolute;
33-
top: 50%;
34-
right: 15px;
35-
width: 44px;
36-
padding: 0;
37-
border: 0;
38-
font-family: FaktSlabPro,Arial,Helvetica,sans-serif;
39-
font-weight: 300;
40-
font-size: 30px;
41-
line-height: 1.2;
42-
background: none;
43-
cursor: pointer;
44-
outline: 0;
45-
opacity: 1;
46-
margin-top: -.5em;
47-
}
48-
49-
.SiteRibbon-x:hover {
50-
opacity: .7;
51-
}
52-
53-
@media (min-width: 992px) {
54-
font-size: 20px;
55-
}
56-
</style>
57-
58-
<div class="SiteRibbon is-hidden" id="announcement">
59-
<div class="container">
60-
<div class="u-pr5">
61-
<span class="SiteRibbon-text u-fs20">
62-
Say ‘no’ to Ugly Apps. Modern UI with new React, Angular and Vue components.
63-
<a href="https://www.telerik.com/support/whats-new/kendo-ui?utm_medium=telerik&utm_source=yellow-ribbon&utm_campaign=kendo-ui-awareness-r118release"><strong>See our New Release!</strong></a>
64-
</span>
65-
</div>
66-
<button type="button" class="SiteRibbon-x">×</button>
67-
</div>
68-
</div>
69-
70-
{% javascript "ribbon" %}
71-
1+
<div class="SiteRibbon js-r1dt" style="display:none;"><div class="container">
2+
<span class="SiteRibbon-text">
3+
{{page.announcement}}
4+
</span></div></div>
725
<script>
73-
$(".SiteRibbon-x")
74-
.click(function() {
75-
$(document.documentElement).addClass("no-announcement");
76-
$(this).closest(".SiteRibbon").slideUp();
77-
});
78-
$(document.documentElement).toggleClass("no-announcement", $(".SiteRibbon").hasClass("is-hidden"));
6+
$(document).ready(function(){
7+
$('.js-r1dt').insertBefore($('#js-tlrk-nav')).end().show();
8+
});
799
</script>

_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
apiColumnsCount = {{ site.api_columns_count }};
9797
{% endif %}
9898
</script>
99-
99+
{% if page.announcement %}{% include announcement.html %}{% endif %}
100100
{% include nav.html %}
101101

102102
<div id="content">

0 commit comments

Comments
 (0)