Skip to content
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

Allow independent scrolling in split-column mode #433

Merged
merged 5 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
32 changes: 32 additions & 0 deletions src/nginxconfig/scss/_columns.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Copyright 2023 DigitalOcean

This code is licensed under the MIT License.
You may obtain a copy of the License at
https://github.com/digitalocean/nginxconfig.io/blob/master/LICENSE or https://mit-license.org/

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

.columns {
.column-scroll-y {
overflow-y: auto;
height: 100vh;
}
}
3 changes: 2 additions & 1 deletion src/nginxconfig/scss/style.scss
maskeynihal marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022 DigitalOcean
Copyright 2023 DigitalOcean

This code is licensed under the MIT License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -50,4 +50,5 @@ $callout: #f3f5f9;
@import "code";
@import "files";
@import "footer";
@import "columns";
}
6 changes: 3 additions & 3 deletions src/nginxconfig/templates/app.vue
maskeynihal marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright 2022 DigitalOcean
Copyright 2023 DigitalOcean

This code is licensed under the MIT License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -59,7 +59,7 @@ THE SOFTWARE.

<div class="main container" :style="{ display: ready ? undefined : 'none' }">
<div class="columns is-multiline">
<div :class="`column ${splitColumn ? 'is-half' : 'is-full'} is-full-touch`">
<div :class="`column ${splitColumn ? 'is-half column-scroll-y' : 'is-full'} is-full-touch`">
<h2>{{ $t('templates.app.perWebsiteConfig') }}</h2>

<div class="tabs">
Expand Down Expand Up @@ -96,7 +96,7 @@ THE SOFTWARE.
<Setup :data="{ domains: domains.filter(d => d !== null), global, confFiles }"></Setup>
</div>

<div :class="`column ${splitColumn ? 'is-half' : 'is-full'} is-full-touch`">
<div :class="`column ${splitColumn ? 'is-half column-scroll-y' : 'is-full'} is-full-touch`">
<h2>{{ $t('templates.app.configFiles') }}</h2>
<div ref="files" class="columns is-multiline files">
<component
Expand Down
11 changes: 10 additions & 1 deletion src/nginxconfig/templates/footer.vue
maskeynihal marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="footer">
<div class="container">
<p>
<a href="#top" class="button is-primary is-small">{{ $t('templates.footer.backToTop') }}</a>
<button type="button" class="button is-primary is-small" @click="handleScrollToTop">{{ $t('templates.footer.backToTop') }}</button>

Check warning on line 31 in src/nginxconfig/templates/footer.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected 1 line break after opening tag (`<button>`), but no line breaks found

Check warning on line 31 in src/nginxconfig/templates/footer.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected 1 line break before closing tag (`</button>`), but no line breaks found
MattIPv4 marked this conversation as resolved.
Show resolved Hide resolved
</p>
<p>
{{ $t('templates.footer.thisToolIs') }}
Expand Down Expand Up @@ -68,5 +68,14 @@
components: {
ExternalLink,
},
methods: {
handleScrollToTop: () => {
window.scrollTo({top: 0});

const columns = document.querySelectorAll('.column-scroll-y');

columns.forEach(column => column.scrollTo({top: 0}));
maskeynihal marked this conversation as resolved.
Show resolved Hide resolved
},
},
};
</script>