Skip to content

Commit

Permalink
Replaced hidden classes with hidden attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Jun 5, 2022
1 parent f1cfe4c commit ce0484e
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 21 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions material/assets/stylesheets/main.1e7fa3a9.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions material/assets/stylesheets/main.1e7fa3a9.min.css.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion material/assets/stylesheets/main.ed05e878.min.css

This file was deleted.

1 change: 0 additions & 1 deletion material/assets/stylesheets/main.ed05e878.min.css.map

This file was deleted.

4 changes: 2 additions & 2 deletions material/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{% endif %}
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.ed05e878.min.css' | url }}">
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.1e7fa3a9.min.css' | url }}">
{% if config.theme.palette %}
{% set palette = config.theme.palette %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.cbb835fc.min.css' | url }}">
Expand Down Expand Up @@ -216,7 +216,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.f9fdf24d.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.f758a944.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion src/assets/javascripts/components/header/_/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ export function mountHeader(
combineLatestWith(header$)
)
.subscribe(([{ active }, { hidden }]) => {
el.classList.toggle("md-header--hidden", hidden)
el.classList.toggle("md-header--shadow", active && !hidden)
el.hidden = hidden
})

/* Link to main area */
Expand Down
4 changes: 2 additions & 2 deletions src/assets/javascripts/components/tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ export function mountTabs(

/* Handle emission */
next({ hidden }) {
el.classList.toggle("md-tabs--hidden", hidden)
el.hidden = hidden
},

/* Handle complete */
complete() {
el.classList.remove("md-tabs--hidden")
el.hidden = false
}
})

Expand Down
17 changes: 9 additions & 8 deletions src/assets/stylesheets/main/layout/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
top: 0;
inset-inline: 0;
z-index: 4;
display: block;
color: var(--md-primary-bg-color);
background-color: var(--md-primary-fg-color);
// Hack: reduce jitter by adding a transparent box shadow of the same size
Expand All @@ -44,6 +45,14 @@
display: none;
}

// Header is hidden
&[hidden] {
transform: translateY(-100%);
transition:
transform 250ms cubic-bezier(0.8, 0, 0.6, 1),
box-shadow 250ms;
}

// Header in shadow state, i.e. shadow is visible
&--shadow {
box-shadow:
Expand All @@ -54,14 +63,6 @@
box-shadow 250ms;
}

// Header in hidden state, i.e. moved out of sight
&--hidden {
transform: translateY(-100%);
transition:
transform 250ms cubic-bezier(0.8, 0, 0.6, 1),
box-shadow 250ms;
}

// Header wrapper
&__inner {
display: flex;
Expand Down
5 changes: 3 additions & 2 deletions src/assets/stylesheets/main/layout/_tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
// Must be higher than the z-index of the back-to-top button, or the button
// will overlay the navigation tabs bar when scrolling up fast.
z-index: 3;
display: block;
width: 100%;
overflow: auto;
color: var(--md-primary-bg-color);
Expand All @@ -46,7 +47,7 @@
}

// Navigation tabs are hidden
&--hidden {
&[hidden] {
pointer-events: none;
}

Expand Down Expand Up @@ -98,7 +99,7 @@

// Hide tabs upon scrolling - disable transition to minimizes repaints
// while scrolling down, while scrolling up seems to be okay
.md-tabs.md-tabs--hidden & {
.md-tabs[hidden] & {
transform: translateY(50%);
opacity: 0;
transition:
Expand Down

0 comments on commit ce0484e

Please sign in to comment.