Skip to content

add sticky help message to get started #2424

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

Merged
merged 2 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions _includes/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
The instructions below cover both Scala 2 and Scala 3.

<div class="inline-sticky-top">
{% altDetails need-help-info-box 'Need Help?' class=help-info %}
*If you are having trouble with setting up Scala, feel free to ask for help in the `#scala-users` channel of
[our Discord](https://discord.com/invite/scala).*
{% endaltDetails %}
</div>

## Try Scala without installing anything

To start experimenting with Scala right away, use <a href="https://scastie.scala-lang.org/pEBYc5VMT02wAGaDrfLnyw" target="_blank">“Scastie” in your browser</a>.
Expand Down
7 changes: 6 additions & 1 deletion _plugins/alt-details-lib/alt-details.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Jekyll
module AltDetails
class AltDetailsBlock < Liquid::Block
SYNTAX = /^\s*(#{Liquid::QuotedFragment})\s+(#{Liquid::QuotedFragment})/o
SYNTAX = /^\s*(#{Liquid::QuotedFragment})\s+(#{Liquid::QuotedFragment})(?=\s+class=(#{Liquid::QuotedFragment}))?/o
Syntax = SYNTAX

alias_method :render_block, :render
Expand All @@ -18,6 +18,11 @@ def initialize(block_name, markup, tokens)
if markup =~ SYNTAX
@name = unquote($1)
@title = unquote($2)
@css_classes = ""
if $3
# append $3 to @css_classes
@css_classes = "#{@css_classes} #{unquote($3)}"
end
else
raise SyntaxError.new("Block #{block_name} requires an id and a title")
end
Expand Down
2 changes: 1 addition & 1 deletion _plugins/alt-details-lib/template.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="place-inline">
<div id="<%= @name %>" class="alt-details">
<div id="<%= @name %>" class="alt-details<%= @css_classes %>">
<input class="alt-details-control" type="checkbox" id="<%= @name %>__control" hidden aria-hidden="true">
<label class="alt-details-toggle" for="<%= @name %>__control"><%= @title %></label>
<div class="alt-details-detail">
Expand Down
42 changes: 26 additions & 16 deletions _sass/base/helper.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,45 @@
//------------------------------------------------

.wrap {
@include outer-container;
@include padding(0 20px);
@include outer-container;
@include padding(0 20px);
}

.place-inline {
// add vertical margin
@include outer-container;
@include margin(20px 0);
// add vertical margin
@include outer-container;
@include margin(20px 0);
}

.inline-sticky-top {
position: sticky;
top: 15px;
background: #fff;
-webkit-box-shadow: 0 0 18px 20px #fff;
-moz-box-shadow: 0 0 18px 20px #fff;
box-shadow: 0 0 18px 20px #fff;
z-index: 999;
}

.wrap-inline {
// add vertical padding
@include outer-container;
@include padding(20px 0);
// add vertical padding
@include outer-container;
@include padding(20px 0);
}

.wrap-tab {
@extend .wrap-narrow;
margin-top: 20px;
margin-bottom: 20px;
@extend .wrap-narrow;
margin-top: 20px;
margin-bottom: 20px;
}

.wrap-narrow {
@include outer-container;
@include padding(0 10px);
@include outer-container;
@include padding(0 10px);
}

.dot {
font-size: 10px;
color: rgba($base-font-color-light, 0.6);
margin: 0 3px;
font-size: 10px;
color: rgba($base-font-color-light, 0.6);
margin: 0 3px;
}
19 changes: 19 additions & 0 deletions _sass/components/alt-details.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
//------------------------------------------------
//------------------------------------------------

.alt-details.help-info {
.alt-details-toggle {
background-color: $brand-primary;
color: white;

&:hover {
background-color: darken($brand-primary, 15%);
}
}

.alt-details-detail {
background: #fae6e6
}
}

.alt-details {
@include span-columns(12);

Expand Down Expand Up @@ -35,6 +50,10 @@

}

.alt-details-control {
margin: 0;
}

.alt-details-control+.alt-details-toggle+.alt-details-detail {
// by default, hide the details
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion _sass/layout/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
text-align: center;
z-index: 2;
color: #f0f3f3;
background-color: #dc322f;
background-color: $brand-primary;
border-radius: 50%;
display: none;

Expand Down