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

Add title section to settingsdialog #2719

Merged
merged 2 commits into from
Jun 2, 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
93 changes: 83 additions & 10 deletions src/components/AppSettingsDialog/AppSettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,37 @@ providing the section's title prop. You can put your settings within each
<template>
<div>
<button @click="settingsOpen = true">Show Settings</button>
<AppSettingsDialog :open.sync="settingsOpen" showNavigation=true>
<AppSettingsDialog :open.sync="settingsOpen" :show-navigation="true" title="Application settings">
<AppSettingsSection title="Example title 1">
Some example content
</AppSettingsSection>
<AppSettingsSection title="Example title 2">
Some more content
</AppSettingsSection>
<AppSettingsSection title="Example title 3">
Some example content
</AppSettingsSection>
<AppSettingsSection title="Example title 4">
Some more content
</AppSettingsSection>
<AppSettingsSection title="Example title 5">
Some example content
</AppSettingsSection>
<AppSettingsSection title="Example title 6">
Some more content
</AppSettingsSection>
<AppSettingsSection title="Example title 7">
Some example content
</AppSettingsSection>
<AppSettingsSection title="Example title 8">
Some more content
</AppSettingsSection>
<AppSettingsSection title="Example title 9">
Some more content
</AppSettingsSection>
<AppSettingsSection title="Example title 10">
Some more content
</AppSettingsSection>
</AppSettingsDialog>
</div>
</template>
Expand Down Expand Up @@ -91,6 +115,14 @@ export default {
type: String,
default: 'body',
},

/**
* Title of the settings
*/
title: {
type: String,
default: '',
},
},

data() {
Expand Down Expand Up @@ -224,7 +256,7 @@ export default {
role: 'tablist',
},
}, this.getSettingsNavigation(this.$slots.default).map(item => {
return createListElemtent(item)
return createListElement(item)
}))])]
} else {
return []
Expand All @@ -237,7 +269,7 @@ export default {
* @param {object} item the navigation item
* @return {object} the list element
*/
const createListElemtent = (item) => createElement('li', {}, [createElement('a', {
const createListElement = (item) => createElement('li', {}, [createElement('a', {
class: {
'navigation-list__link': true,
'navigation-list__link--active': item === this.selectedSection,
Expand Down Expand Up @@ -266,17 +298,40 @@ export default {
close: () => { this.handleCloseModal() },
},
}, [
// main app-settings root element
createElement('div', {
attrs: {
class: 'app-settings',
},
}, [...createAppSettingsNavigation(),
createElement('div', {
attrs: {
class: 'app-settings__content',
}, [
// app-settings title
this.title
? createElement('h2', {
attrs: {
class: 'app-settings__title',
},
}, this.title)
: undefined,

// app-settings navigation + content
createElement(
'div',
{
attrs: {
class: 'app-settings__wrapper',
},
},
ref: 'settingsScroller',
}, this.$slots.default)]),
[
...createAppSettingsNavigation(),
createElement('div', {
attrs: {
class: 'app-settings__content',
},
ref: 'settingsScroller',
}, this.$slots.default),
]
),
]),
])
} else {
return undefined
Expand All @@ -290,14 +345,32 @@ export default {

::v-deep .modal-wrapper .modal-container {
display: flex;
overflow: hidden;
}

.app-settings {
display: flex;
width: 100%;
display: flex;
flex-direction: column;
min-width: 0;
&__title {
padding-top: 12px;
text-align: center;
}
&__wrapper {
display: flex;
width: 100%;
overflow: hidden;
height: 100%;
position: relative;
}
&__navigation {
min-width: 200px;
margin-right: 20px;
overflow-x: hidden;
overflow-y: auto;
position: relative;
height: 100%;
}
&__content {
max-width: 100vw;
Expand Down
2 changes: 2 additions & 0 deletions src/components/AppSettingsSection/AppSettingsSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export default {
margin-bottom: 80px;
&__title {
font-size: 20px;
margin: 0;
padding: 20px 0;
font-weight: bold;
overflow: hidden;
white-space: nowrap;
Expand Down