Fix sidebar and tabs on settings on small screens in admin UI (#19533)
This commit is contained in:
parent
6094a916b1
commit
ad83e64795
4 changed files with 78 additions and 43 deletions
|
@ -247,8 +247,31 @@ function main() {
|
||||||
input.readonly = oldReadOnly;
|
input.readonly = oldReadOnly;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const toggleSidebar = () => {
|
||||||
|
const sidebar = document.querySelector('.sidebar ul');
|
||||||
|
const toggleButton = document.querySelector('.sidebar__toggle__icon');
|
||||||
|
|
||||||
|
if (sidebar.classList.contains('visible')) {
|
||||||
|
document.body.style.overflow = null;
|
||||||
|
toggleButton.setAttribute('aria-expanded', false);
|
||||||
|
} else {
|
||||||
|
document.body.style.overflow = 'hidden';
|
||||||
|
toggleButton.setAttribute('aria-expanded', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleButton.classList.toggle('active');
|
||||||
|
sidebar.classList.toggle('visible');
|
||||||
|
};
|
||||||
|
|
||||||
delegate(document, '.sidebar__toggle__icon', 'click', () => {
|
delegate(document, '.sidebar__toggle__icon', 'click', () => {
|
||||||
document.querySelector('.sidebar ul').classList.toggle('visible');
|
toggleSidebar();
|
||||||
|
});
|
||||||
|
|
||||||
|
delegate(document, '.sidebar__toggle__icon', 'keydown', e => {
|
||||||
|
if (e.key === ' ' || e.key === 'Enter') {
|
||||||
|
e.preventDefault();
|
||||||
|
toggleSidebar();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Empty the honeypot fields in JS in case something like an extension
|
// Empty the honeypot fields in JS in case something like an extension
|
||||||
|
|
|
@ -31,23 +31,17 @@ $content-width: 840px;
|
||||||
|
|
||||||
&__toggle {
|
&__toggle {
|
||||||
display: none;
|
display: none;
|
||||||
background: lighten($ui-base-color, 8%);
|
background: darken($ui-base-color, 4%);
|
||||||
height: 48px;
|
border-bottom: 1px solid lighten($ui-base-color, 4%);
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
&__logo {
|
&__logo {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
display: inline-block;
|
display: block;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
svg {
|
|
||||||
fill: $primary-text-color;
|
|
||||||
height: 20px;
|
|
||||||
position: relative;
|
|
||||||
bottom: -2px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__icon {
|
&__icon {
|
||||||
|
@ -55,15 +49,27 @@ $content-width: 840px;
|
||||||
color: $darker-text-color;
|
color: $darker-text-color;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
font-size: 20px;
|
font-size: 18px;
|
||||||
padding: 15px;
|
padding: 10px;
|
||||||
}
|
margin: 5px 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
a {
|
&:focus {
|
||||||
&:hover,
|
background: $ui-base-color;
|
||||||
&:focus,
|
}
|
||||||
&:active {
|
|
||||||
background: lighten($ui-base-color, 12%);
|
.fa-times {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
.fa-times {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-bars {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +85,7 @@ $content-width: 840px;
|
||||||
display: inherit;
|
display: inherit;
|
||||||
margin: inherit;
|
margin: inherit;
|
||||||
width: inherit;
|
width: inherit;
|
||||||
height: 20px;
|
height: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: $no-columns-breakpoint) {
|
@media screen and (max-width: $no-columns-breakpoint) {
|
||||||
|
@ -189,9 +195,7 @@ $content-width: 840px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__heading {
|
&__heading {
|
||||||
padding-bottom: 36px;
|
margin-bottom: 45px;
|
||||||
border-bottom: 1px solid lighten($ui-base-color, 8%);
|
|
||||||
margin-bottom: 40px;
|
|
||||||
|
|
||||||
&__row {
|
&__row {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -208,46 +212,43 @@ $content-width: 840px;
|
||||||
|
|
||||||
&__tabs {
|
&__tabs {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
margin-bottom: -31px;
|
width: 100%;
|
||||||
|
|
||||||
& > div {
|
& > div {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
flex-wrap: wrap;
|
||||||
|
gap: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 7px 15px;
|
padding: 7px 10px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
color: $darker-text-color;
|
color: $darker-text-color;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
position: relative;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
&.selected {
|
|
||||||
font-weight: 700;
|
|
||||||
color: $primary-text-color;
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
content: "";
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
border-bottom: 1px solid $ui-highlight-color;
|
|
||||||
position: absolute;
|
|
||||||
bottom: -5px;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus,
|
&:focus,
|
||||||
&:active {
|
&:active {
|
||||||
background: lighten($ui-base-color, 4%);
|
background: lighten($ui-base-color, 4%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.selected {
|
||||||
|
font-weight: 700;
|
||||||
|
color: $primary-text-color;
|
||||||
|
background: $ui-highlight-color;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus,
|
||||||
|
&:active {
|
||||||
|
background: lighten($ui-highlight-color, 4%);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,6 +383,14 @@ $content-width: 840px;
|
||||||
|
|
||||||
&.visible {
|
&.visible {
|
||||||
display: block;
|
display: block;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 10;
|
||||||
|
width: 100%;
|
||||||
|
height: calc(100vh - 56px);
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
background: $ui-base-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,9 @@
|
||||||
= link_to root_path do
|
= link_to root_path do
|
||||||
= logo_as_symbol(:wordmark)
|
= logo_as_symbol(:wordmark)
|
||||||
|
|
||||||
= link_to '#', class: 'sidebar__toggle__icon' do
|
= link_to '#', class: 'sidebar__toggle__icon', 'aria-label': t('navigation.toggle_menu'), 'aria-expanded': 'false' do
|
||||||
= fa_icon 'bars'
|
= fa_icon 'bars'
|
||||||
|
= fa_icon 'times'
|
||||||
|
|
||||||
= render_navigation
|
= render_navigation
|
||||||
|
|
||||||
|
|
|
@ -1249,6 +1249,8 @@ en:
|
||||||
carry_blocks_over_text: This user moved from %{acct}, which you had blocked.
|
carry_blocks_over_text: This user moved from %{acct}, which you had blocked.
|
||||||
carry_mutes_over_text: This user moved from %{acct}, which you had muted.
|
carry_mutes_over_text: This user moved from %{acct}, which you had muted.
|
||||||
copy_account_note_text: 'This user moved from %{acct}, here were your previous notes about them:'
|
copy_account_note_text: 'This user moved from %{acct}, here were your previous notes about them:'
|
||||||
|
navigation:
|
||||||
|
toggle_menu: Toggle menu
|
||||||
notification_mailer:
|
notification_mailer:
|
||||||
admin:
|
admin:
|
||||||
report:
|
report:
|
||||||
|
|
Loading…
Reference in a new issue