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

feat(NcAppContent): add mobileLayout prop #6364

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

devlinjunker
Copy link

@devlinjunker devlinjunker commented Jan 11, 2025

☑️ Resolves

  • Enables horizontal-split layout for mobile devices. This can be useful if you want to still see the list and details at the same time
  • Defaults to no-split still so no change for callers that don't pass in the mobileLayout property

🖼️ Screenshots

🏚️ Before 🏡 After
Jan-10-2025 17-52-17 Jan-10-2025 17-53-38

🚧 Tasks

  • add mobileLayout property
  • add horizontal-split option for mobileLayout property

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable
    - [ ] 3️⃣ Backport to next requested with a Vue 3 upgrade

Signed-off-by: Devlin Junker <[email protected]>
Signed-off-by: Devlin Junker <[email protected]>
@devlinjunker devlinjunker changed the title Add mobileLayout prop to NcAppContent feat(NcAppContent): Add mobileLayout prop to NcAppContent Jan 14, 2025
@devlinjunker
Copy link
Author

Any thoughts or feedback here? @ShGKme @raimund-schluessler

@ShGKme ShGKme added enhancement New feature or request 3. to review Waiting for reviews feature: app-content Related to the app-content component labels Jan 24, 2025
@ShGKme ShGKme added this to the 8.23.0 milestone Jan 24, 2025
Copy link

codecov bot commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 42.50%. Comparing base (0d3715f) to head (9b6f558).
Report is 146 commits behind head on master.

Files with missing lines Patch % Lines
src/components/NcAppContent/NcAppContent.vue 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6364      +/-   ##
==========================================
+ Coverage   42.26%   42.50%   +0.23%     
==========================================
  Files         155      156       +1     
  Lines        3996     4028      +32     
  Branches     1001     1038      +37     
==========================================
+ Hits         1689     1712      +23     
- Misses       2199     2200       +1     
- Partials      108      116       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ShGKme ShGKme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, can be useful.

Please, fix linting issues like trailing spaces and commas.

@media only screen and (width < $breakpoint-mobile) {
display: none;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint error

Suggested change
}
}

@media only screen and (width < $breakpoint-mobile) {
display: none;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

default: 'no-split',
validator(value) {
return ['no-split', 'horizontal-split'].includes(value)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
},

validator(value) {
return ['no-split', 'horizontal-split'].includes(value)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
},

&.splitpanes--horizontal-mobile {
.splitpanes__pane-details{
@media only screen and (width < $breakpoint-mobile) {
min-height:30%;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
min-height:30%;
min-height: 30%;

}

&.splitpanes--horizontal-mobile {
.splitpanes__pane-details{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.splitpanes__pane-details{
.splitpanes__pane-details {

@@ -60,22 +60,23 @@ The list size must be between the min and the max width value.

<template v-if="hasList">
<!-- Mobile view does not allow resizeable panes -->
<div v-if="isMobile || layout === 'no-split'"
<div v-if="(isMobile && mobileLayout === 'no-split') || layout === 'no-split' "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditions are quire complicated now.

What about making a new computed property, for instance, currentLayout, that returns corresponding layout depending on isMobile.

Then we can always just check one property value without complex expressions.

@@ -175,7 +176,7 @@ export default {
},

/**
* When in mobile view, only the list or the details are shown
* When in 'no-split' mobile view, only the list or the details are shown
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this line then. It's now covered by the new prop

@@ -400,6 +412,22 @@ export default {
scrollbar-width: auto;
}

&:not(.splitpanes--horizontal-mobile) {
.splitpanes__pane-list{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.splitpanes__pane-list{
.splitpanes__pane-list {

Comment on lines +415 to +420
&:not(.splitpanes--horizontal-mobile) {
.splitpanes__pane-list{
@media only screen and (width < $breakpoint-mobile) {
display: none;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's control it in JS instead as it was.

@ShGKme ShGKme requested a review from GretaD January 24, 2025 20:15
@ShGKme ShGKme changed the title feat(NcAppContent): Add mobileLayout prop to NcAppContent feat(NcAppContent): add mobileLayout prop Jan 24, 2025
@devlinjunker
Copy link
Author

Thanks for taking a look! Will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request feature: app-content Related to the app-content component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants