Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 319a58c

Browse files
committed
CSS immprovement
1 parent b813a1f commit 319a58c

File tree

15 files changed

+375
-358
lines changed

15 files changed

+375
-358
lines changed

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source 'https://rubygems.org'
22

3-
gem 'opal'
4-
gem 'opal_hot_reloader' # this will move to hyperloop.js
3+
gem 'opal', '0.10.5'
4+
gem 'opal_hot_reloader'
55
gem 'foreman'
66
gem 'rake'
77

Gemfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ GEM
22
remote: https://rubygems.org/
33
specs:
44
concurrent-ruby (1.0.5)
5-
ffi (1.9.18)
5+
ffi (1.9.23)
66
foreman (0.84.0)
77
thor (~> 0.19.1)
88
hike (1.2.3)
@@ -19,11 +19,11 @@ GEM
1919
opal (~> 0.10.4)
2020
sprockets (~> 3.1)
2121
tilt (>= 1.4)
22-
opal_hot_reloader (0.1.4)
22+
opal_hot_reloader (0.1.5)
2323
listen (~> 3.0)
2424
websocket
25-
rack (2.0.3)
26-
rake (12.0.0)
25+
rack (2.0.4)
26+
rake (12.3.0)
2727
rb-fsevent (0.10.2)
2828
rb-inotify (0.9.10)
2929
ffi (>= 0.5.0, < 2)
@@ -34,14 +34,14 @@ GEM
3434
rack (> 1, < 3)
3535
thor (0.19.4)
3636
tilt (2.0.8)
37-
websocket (1.2.4)
37+
websocket (1.2.5)
3838

3939
PLATFORMS
4040
ruby
4141

4242
DEPENDENCIES
4343
foreman
44-
opal
44+
opal (= 0.10.5)
4545
opal-sprockets
4646
opal_hot_reloader
4747
rack

app/components/home/home_page.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ def main_content
3939

4040
AppMenu(section: 'home')
4141

42+
43+
#CANVAS(id: "c_n5", width: "1474", height: "800", style: { position: 'absolute', top: '0px', left: '0px', zIndex: '1', opacity: '0.5'})
4244
DIV(class: 'masthead segment stopped') do
4345
DIV(class: 'ui page grid') do
4446
DIV(class: 'column') do

app/components/searchresult/search_result_body.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ def highlight(text, search_string)
6161

6262

6363
H2(class: 'ui header') do
64-
IMG(src: 'dist/images/icons/gear.png')
64+
#IMG(src: 'dist/images/icons/gear.png')
65+
Sem.Icon(name: 'chevron right')
6566
DIV(class: 'content') do
6667

6768
A() do

app/components/shared/code_mirror.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,25 @@ class CodeMirror < Hyperloop::Component
1111
mutate.code params.code
1212
end
1313

14-
render(DIV) do
15-
Sem.Container {
14+
render do
15+
16+
17+
18+
DIV(class: 'runable_code_blocks') do
19+
20+
Sem.Segment(class: 'codeeditor-header', inverted: true) {
21+
Sem.Icon(name: :edit)
22+
"Code editor"
23+
}
24+
1625
mirror
1726

1827
unless compile && evaluate && render_component
1928
Sem.Message(negative: true) {
2029
PRE { state.compile_error }
2130
}
2231
end
23-
}
32+
end
2433
end
2534

2635
def compile

app/components/shared/md_converter.rb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ def on_code code, lang
5656
cb[:code] = code
5757
cb[:lang] = lang
5858
@code_blocks << cb
59-
return_html = "<pre><code class='lang-#{lang} hljs'>#{ cb[:html] }</code></pre>"
59+
60+
return_html = "<pre class='pre-md-code'><code class='lang-#{lang} hljs'>#{ cb[:html] }</code></pre>"
61+
62+
# if (lang == 'ruby-runable')
63+
# return_html = "<div class='ui inverted instructive segment runablecode-container'><div class='ui attached top label'><span class='title'>Hyperloop Code</span><em>Live executed code</em></div>#{return_html}</div>"
64+
# end
65+
6066
@headings[@headings_index-1][:paragraphs] << return_html
6167
return_html
6268
end
@@ -81,12 +87,17 @@ def on_heading text, level
8187
heading[:pagename] = @pagename
8288
heading[:text] = text
8389
heading[:level] = level
84-
heading[:slug] = text.downcase.gsub(/[^\w]+/g, '-')
90+
heading[:slug] = text.downcase.gsub(/[^\w]+/, '-')
8591
heading[:paragraphs] = []
8692
@headings_index += 1
8793

94+
levelicon = ['', 'bookmark outline', 'circle outline', 'square outline']
95+
leveliconhtml = "<i class='#{levelicon[level-1]} icon'></i>&nbsp;"
96+
leveliconhtml = "" if level==1
97+
98+
8899
@headings << heading
89-
"<h#{level} class='doc_h#{level} chapteranchor' id='#{heading[:slug]}'>#{text}</h#{level}>"
100+
"<p class='ptopmargin-#{level}'></p><h#{level} class='doc_h#{level} chapteranchor' id='#{heading[:slug]}'>#{leveliconhtml}#{text}</h#{level}>"
90101
end
91102

92103
def on_paragraph text

app/components/shared/page_body.rb

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class PageBody < Hyperloop::Component
66
mutate.needs_refresh false
77
end
88

9+
910
after_update do
1011
if !NavigationStore.state.slug.empty?
1112
# if !(Element["##{NavigationStore.state.slug}"].nil?)
@@ -16,19 +17,35 @@ class PageBody < Hyperloop::Component
1617
Element['html, body'].animate({
1718
scrollTop: anchorchapter_position
1819
}, 500)
20+
21+
1922
# end
2023
end
24+
convert_runable_code_blocks
2125
end
2226

23-
render(DIV) do
24-
if SiteStore.sections[params.section].loaded?
25-
edit_button if SiteStore.sections[params.section].current_page[:allow_edit]
26-
Sem.Divider(hidden: true)
27-
DIV(dangerously_set_inner_HTML: { __html: SiteStore.sections[params.section].current_page[:html] })
28-
convert_runable_code_blocks
27+
render do
28+
DIV(class: 'page-container') do
29+
if SiteStore.sections[params.section].loaded?
30+
31+
set_pagebody_cssstyle
32+
33+
edit_button if SiteStore.sections[params.section].current_page[:allow_edit]
34+
35+
DIV(class: 'pagebody', dangerously_set_inner_HTML: { __html: SiteStore.sections[params.section].current_page[:html] })
36+
37+
end
2938
end
3039
end
3140

41+
def set_pagebody_cssstyle
42+
43+
#Element['.ptopmargin-2'].prev('h1').css('height', '0em')
44+
# Element['h3'].prev().not('h2').css('margin-bottom', '5em')
45+
# Element['h4'].prev().css('margin-bottom', '5em')
46+
# Element['h2'].before( "<p>Test</p>" )
47+
end
48+
3249
def convert_runable_code_blocks
3350
Element.find('code.lang-ruby-runable').each do |mount_point|
3451
code = mount_point.text
@@ -37,23 +54,21 @@ def convert_runable_code_blocks
3754
end
3855

3956
def edit_button
40-
Sem.Grid(textAlign: :right) {
41-
Sem.GridColumn {
42-
if state.needs_refresh
43-
Sem.Message(positive: true) {
44-
Sem.MessageHeader { "Thank you!" }
45-
P { "PRs are always welcome." }
46-
}
47-
else
48-
Sem.Button(icon: :github, circular: true, label: "Improve this page") {
49-
50-
}.on(:click) do
51-
mutate.needs_refresh true
52-
`window.open(#{SiteStore.sections[params.section].current_page[:edit_url]}, "_blank");`
53-
end
57+
DIV(class: 'edit-github-button') do
58+
if state.needs_refresh
59+
Sem.Message(positive: true) {
60+
Sem.MessageHeader { "Thank you!" }
61+
P { "PRs are always welcome." }
62+
}
63+
else
64+
Sem.Button(icon: :github, circular: true, label: "Improve this page") {
65+
66+
}.on(:click) do
67+
mutate.needs_refresh true
68+
`window.open(#{SiteStore.sections[params.section].current_page[:edit_url]}, "_blank");`
5469
end
55-
}
56-
}
70+
end
71+
end
5772
end
5873

5974
end

app/components/shared/page_toc.old.rb

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

app/components/shared/page_toc.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class PageToc < Hyperloop::Component
1111
before_mount do
1212

1313
if (NavigationStore.accordionindex < 0)
14-
NavigationStore.mutate.accordionindex -1
14+
NavigationStore.mutate.accordionindex(-1)
1515
end
1616
end
1717

app/css/docs.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ ul.list li {
112112
/* text and headers */
113113
h1 {
114114
margin: 0px 0px 20px;
115-
padding: 50px 0px 5px;
115+
padding: 20px 0px 5px;
116116
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
117117
}
118118

@@ -139,7 +139,7 @@ code {
139139
vertical-align: baseline;
140140
}
141141
pre code {
142-
box-shadow: none;
142+
143143
border: none;
144144
padding: 0px;
145145
font-size: 1em;
@@ -234,7 +234,7 @@ a:hover {
234234
z-index: -1;
235235
margin: 0em;
236236
min-height: 220px;
237-
padding-top: 70px;
237+
padding-top: 80px;
238238
padding-bottom: 30px;
239239
background-color: #FFFFFF;
240240
border-bottom: 1px solid #DDDDDD;

0 commit comments

Comments
 (0)