Skip to content

Commit 0865f4c

Browse files
committed
add modal UI - unused
1 parent cb68304 commit 0865f4c

File tree

7 files changed

+136
-5
lines changed

7 files changed

+136
-5
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
require 'erb'
2+
3+
module Jekyll
4+
module ModalDetails
5+
class ModalDetailsBlock < Liquid::Block
6+
SYNTAX = /^\s*(#{Liquid::QuotedFragment})/o
7+
Syntax = SYNTAX
8+
9+
alias_method :render_block, :render
10+
11+
def unquote(string)
12+
string.gsub(/^['"]|['"]$/, '')
13+
end
14+
15+
def initialize(block_name, markup, tokens)
16+
super
17+
18+
if markup =~ SYNTAX
19+
@name = unquote($1)
20+
else
21+
raise SyntaxError.new("Block #{block_name} requires an id")
22+
end
23+
end
24+
25+
def render(context)
26+
site = context.registers[:site]
27+
converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
28+
modalDetailsContent = converter.convert(render_block(context))
29+
currentDirectory = File.dirname(__FILE__)
30+
templateFile = File.read(currentDirectory + '/template.erb')
31+
template = ERB.new(templateFile)
32+
template.result(binding)
33+
end
34+
end
35+
end
36+
end
37+
38+
Liquid::Template.register_tag('modal', Jekyll::ModalDetails::ModalDetailsBlock)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Jekyll
2+
module ModalDetails
3+
VERSION = "1.1.1"
4+
end
5+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<div id="<%= @name %>" class="modal-window">
2+
<div class="modal-content">
3+
<div class="wrap">
4+
<div class="content-modal documentation">
5+
<div class="inner-box">
6+
<a href="#!" title="Close" class="modal-close">Close</a>
7+
<div class="modal-inner">
8+
<%= modalDetailsContent %>
9+
</div>
10+
</div>
11+
</div>
12+
</div>
13+
</div>
14+
</div>

_plugins/modal_details.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require_relative "modal-details-lib/modal-details"

_sass/base/helper.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
top: 15px;
1919
margin-bottom: 25px;
2020
background: #fff;
21-
-webkit-box-shadow: 0 0 18px 20px #fff;
22-
-moz-box-shadow: 0 0 18px 20px #fff;
21+
-webkit-box-shadow: 0 7px 15px 5px #fff;
22+
-moz-box-shadow: 0 7px 15px 5px #fff;
2323
box-shadow: 0 7px 15px 5px #fff;
2424
z-index: 5;
2525
}

_sass/components/alt-details.scss

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,66 @@
22
//------------------------------------------------
33
//------------------------------------------------
44

5+
.modal-window {
6+
// derived from https://codepen.io/timothylong/pen/AJxrPR
7+
position: fixed;
8+
background-color: rgba(255, 255, 255, 0.35);
9+
top: 0;
10+
right: 0;
11+
bottom: 0;
12+
left: 0;
13+
z-index: 999;
14+
visibility: hidden;
15+
opacity: 0;
16+
pointer-events: none;
17+
transition: all 0.5s;
18+
19+
&:target {
20+
opacity: 1;
21+
visibility: visible;
22+
pointer-events: auto;
23+
}
24+
25+
&>.modal-content {
26+
.content-modal {
27+
.modal-inner {
28+
max-height: calc(60vh);
29+
overflow-y: auto;
30+
}
31+
top: 20vh;
32+
transform: translate(0%, 20vh);
33+
-webkit-box-shadow: 0 7px 15px 5px #ccc;
34+
-moz-box-shadow: 0 7px 15px 5px #ccc;
35+
box-shadow: 0 7px 15px 5px #ccc;
36+
}
37+
}
38+
39+
header {
40+
font-weight: bold;
41+
}
42+
43+
h1 {
44+
font-size: 150%;
45+
margin: 0 0 15px;
46+
}
47+
}
48+
49+
.modal-close {
50+
color: #aaa;
51+
line-height: 50px;
52+
font-size: 80%;
53+
position: absolute;
54+
right: 0;
55+
text-align: center;
56+
top: 0;
57+
width: 70px;
58+
text-decoration: none;
59+
60+
&:hover {
61+
color: black;
62+
}
63+
}
64+
565
.alt-details.help-info {
666
.alt-details-toggle {
767
background-color: $brand-primary;
@@ -54,14 +114,14 @@
54114
margin: 0;
55115
}
56116

57-
.alt-details-control+.alt-details-toggle+.alt-details-detail {
117+
.alt-details-control+label+.alt-details-detail {
58118
// by default, hide the details
59119
position: absolute;
60120
top: -999em;
61121
left: -999em;
62122
}
63123

64-
.alt-details-control:checked+.alt-details-toggle+.alt-details-detail {
124+
.alt-details-control:checked+label+.alt-details-detail {
65125
// show the details when the control is checked
66126
position: static;
67127
}
@@ -71,7 +131,8 @@
71131
content: "\f13a"; // <i class="fa-solid fa-circle-chevron-down"></i>
72132
}
73133

74-
.alt-details-detail {
134+
// theme for details of expanded "alt-details-toggle" button
135+
.alt-details-control+.alt-details-toggle+.alt-details-detail {
75136
// The detail box appears to be underneath the toggle button
76137
// so we add a padding to the top and push it up.
77138
border-bottom: $base-border-gray;

_sass/layout/inner-main.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@
3535
}
3636
}
3737

38+
.content-modal {
39+
@include span-columns(7);
40+
margin-left: 50px;
41+
@include bp(large) {
42+
@include fill-parent;
43+
order: 2;
44+
margin-left: 0;
45+
margin-right: 0;
46+
}
47+
}
48+
3849
.content-nav,
3950
.content-nav-blog {
4051
@include span-columns(4);
@@ -51,6 +62,7 @@
5162
}
5263
}
5364

65+
.content-modal,
5466
.content-primary {
5567
.documentation,
5668
.tools {

0 commit comments

Comments
 (0)