just-the-docs/_includes/css/callouts.scss.liquid
Peter Mosses 70b34f01f7
Combination (#578)
This PR combines (and resolves conflicts between) #448, #463, #466, #494, #495, #496, #498, and #572. 

The main aim is to facilitate use of several of the implemented features _together_, when using the fork as a remote theme. It should also simplify merging the included PRs into a future release.

The branch [combination-rec-nav](https://github.com/pdmosses/just-the-docs/tree/combination-rec-nav) adds [multi-level navigation](https://github.com/pmarsceill/just-the-docs/pull/462) and (NEW:) [sibling links](https://github.com/pmarsceill/just-the-docs/pull/394) to the branch used for this PR. It includes updated [documentation for the navigation structure](https://pdmosses.github.io/just-the-docs/docs/navigation-structure/), and reorganised and extended [navigation tests](https://pdmosses.github.io/just-the-docs/tests/navigation/). The documentation and the tests can be browsed at the (temporary) [website published from the combination-rec-nav branch](https://pdmosses.github.io/just-the-docs/).

_Caveat:_ The changes to v0.3.3 in this PR and #462 have not yet been reviewed or approved, and may need updating before merging into a release of the theme. If you use a branch from a PR as a remote theme, there is a risk of such updates affecting your website. Moreover, these branches are likely to be deleted after they have been merged. To avoid  such problems, you could copy the branch that you want to use to your own fork of the theme.

Co-authored-by: Matt Wang <matt@matthewwang.me>
2022-07-04 12:15:10 -07:00

94 lines
2.6 KiB
Plaintext

{%- comment -%}
{% include css/callouts.scss.liquid color_scheme = string %}
produces SCSS for all the callouts in site.callouts. For the "dark"
color scheme, the levels of the text and background colors are reversed.
{%- endcomment -%}
{%- assign callout_background_hue = "000" -%}
{%- assign callout_color_hue = "300" -%}
{%- if site.callouts_level == "loud" or include.color_scheme == "dark" and site.callouts_level != "quiet" -%}
{%- assign callout_background_hue = "300" -%}
{%- assign callout_color_hue = "000" -%}
{%- endif -%}
div.opaque {
background-color: $body-background-color;
}
{%- for callout in site.callouts %}
{%- assign callout_opacity = callout[1].opacity | default: site.callouts_opacity | default: 0.2 -%}
p.{{ callout[0] }}, blockquote.{{ callout[0] }} {
background: rgba(${{ callout[1].color }}-{{ callout_background_hue }}, {{ callout_opacity }});
border-left: $border-radius solid ${{ callout[1].color }}-{{ callout_color_hue }};
border-radius: $border-radius;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
padding: .8rem;
{% if callout[1].title %}
&::before {
color: ${{ callout[1].color }}-{{ callout_color_hue }};
content: "{{ callout[1].title }}";
display: block;
font-weight: bold;
text-transform: uppercase;
font-size: .75em;
padding-bottom: .125rem;
}
{% endif %}
> .{{ callout[0] }}-title {
color: ${{ callout[1].color }}-{{ callout_color_hue }};
display: block;
font-weight: bold;
text-transform: uppercase;
font-size: .75em;
padding-bottom: .125rem;
}
}
p.{{ callout[0] }}-title, blockquote.{{ callout[0] }}-title {
background: rgba(${{ callout[1].color }}-{{ callout_background_hue }}, {{ callout_opacity }});
border-left: $border-radius solid ${{ callout[1].color }}-{{ callout_color_hue }};
border-radius: $border-radius;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
padding: .8rem;
> p:first-child {
margin-top: 0;
margin-bottom: 0;
color: ${{ callout[1].color }}-{{ callout_color_hue }};
display: block;
font-weight: bold;
text-transform: uppercase;
font-size: .75em;
padding-bottom: .125rem;
}
}
blockquote.{{ callout[0] }} {
margin-left: 0;
margin-right: 0;
> p:first-child {
margin-top: 0;
}
> p:last-child {
margin-bottom: 0;
}
}
blockquote.{{ callout[0] }}-title {
margin-left: 0;
margin-right: 0;
> p:nth-child(2) {
margin-top: 0;
}
> p:last-child {
margin-bottom: 0;
}
}
{% endfor -%}