-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MudStack: Responsive Breakpoint Attributes #10596
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
MudStack: Responsive Breakpoint Attributes #10596
Conversation
…ine tuned control over its reaction to the users screen size.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #10596 +/- ##
==========================================
+ Coverage 91.74% 91.79% +0.05%
==========================================
Files 426 426
Lines 13379 13406 +27
Branches 2580 2579 -1
==========================================
+ Hits 12274 12306 +32
+ Misses 530 528 -2
+ Partials 575 572 -3 ☔ View full report in Codecov by Sentry. |
src/MudBlazor.Docs/Pages/Components/Stack/Examples/StackFlexDirectionExample.razor
Outdated
Show resolved
Hide resolved
src/MudBlazor.Docs/Pages/Components/Stack/Examples/StackFlexDirectionExample.razor
Outdated
Show resolved
Hide resolved
This may seem dumb, but what does it mean by |
Just run |
I don't think we should add this (was gonna answer on your issue but you beat me to it with the PR), MudStack is meant to be a simple little helper nothing more. I see very little gain in adding this complexity to it. Someone added Wrapping functionality to MudStack, also makes no sense at all. |
Its cool if this gets rejected or not, I just wanted to make the PR because if it gets officially rejected then I'll just make my own component that does this same thing. I would like to say, if you do reject this component, at the very least consider adding the helper classes in the Styles/utilities/flexbox/_flex-direction.scss because really those are the core functionality of something like this and they are fairly generic and common in similar other libraries for control flex direction at different screen sizes. Its pretty much how I have been using MudStack for the last 3-4 months I just wanted to add the ability to include them as part of the documentation. Though I do disagree that having no way to control when Also, I apologize if this or my statement below comes across as rude, that is not my intention. I understand that tone can sometimes be misinterpreted in text, as I've experienced many times myself. My only goal is to contribute positively to this project that I rely on, not to complicate it. These are changes I found necessary while working on our internal sites, and I thought they might be beneficial to the community as a whole. |
As an example, this was using This still uses custom css even with Because without those classes, this is pretty much what my UI looks like on a Mobile device because ***I did plan on fixing |
@Garderoben I think this could be worthwhile even if it's simplified to be just a single breakpoint that switches between row and column. There is definitely merit adding responsive design support |
I am more than happy to discuss the syntax, but I would like to point out that current syntax is current the simplest I could implement. Which seems odd given that something like <MudStack Breakpoint="Breakpoint.MdAndUp"> This has the advantage that it using an existing enum, which means one less needs to be created, it also means users are familiar with the syntax and how to use it. However, this syntax is far more logic to implement, and I believe has a much bigger issue of making the code harder to understand when being read. Let's discuss the first part, complexity to implement. When using something like the existing <MudStack Breakpoint="Breakpoint.Md"> Which to mean would mean do columns as its the default, until the breakpoint is met, but since the break point is My next issue with a syntax like this is it makes whats happening a little more confusing to the user writing and maybe even a future developer working on the project. Let's look at the two following examples: <MudStack Breakpoint="Breakpoint.MdAndUp"> A developer who understands and has read how Now lets look at the next example: <MudStack Breakpoint="Breakpoint.MdAndUp" Row="true"> In this example, the breakpoint is the same, however because Now with all of this said, this was really the only alternative syntax someone came up with and I just find it to be far more complicated to implement and it makes reading what's happening harder to do. I am in NO WAY saying my syntax is the best, its simply the easier syntax I could implement with minor code changes that I felt made reading and understanding what's happening easy. I am happy to discuss alternative syntax's to find one that feels right for MudBlazor. I do believe that making MudStack be responsive is only a bonus to MudBlazor and something worth looking into, if its not via attributes like this pull request, maybe at the very least making the classes available as part of the core library would be a great step in my opinion. |
I have frequently experienced the aforementioned limitations and believe that the MudBlazor library could benefit from finding a viable solution to enhance MB's responsiveness, especially when transitioning from rows to columns. As a cross-platform MudBlazor user, I recognize this as a common issue among mobile device users. Integrating this complexity into the library at an early stage would be advantageous in my opinion, as responsive design should be an integral part of the library from the outset. If complexity poses a concern in MudStack, perhaps a dedicated component could be added to address this essential feature. |
This syntax As for if we want this feature or not it is a resounding YES from my side. The value it provides is worth the additional complexity in MudStack IMO. And MudStack is one of the simplest components we have, so there is no risk that adding this could pose maintainability problems in the future. Our success is that we offer functionality in an more "csharpy" kind of way which you could also do with just CSS but there are many who have a hard time with CSS and are glad to be able to take what we offer. |
I am more than happy to implement either syntax. And honestly either syntax is not super hard. If the syntax needs to be changed for this to be implemented, I can have that updated in a few hours. Y'all just let me know what I need to make |
@henon though you said
What other responsive components use the |
I think he is talking about:
And non component They have breakpoint settings that uses the |
I did not realize all of those components had that Attribute. In that case, I also agree the syntax should be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments on the scss file, i think we already have all the utilities you would need for this?
And as discussed already if this can be simplified way more i could probably agree on adding it i prefer the syntax <MudStack Breakpoint="Breakpoint.MdAndUp">
but again MudStack was just meant to be a quick little helper, adding this would maybe not complicate this component at this stage but where do we draw the line? MudStack should NOT be a wrapper for flexbox
I have no problem updating the syntax to use <MudStack Row Class="flex-md-column">
<MudPaper Class="mud-theme-primary" Width="100%" Height="64px"/>
<MudPaper Class="mud-theme-secondary" Width="100%" Height="64px"/>
<MudPaper Class="mud-theme-secondary" Width="100%" Height="64px"/>
</MudStack> My only argument with this statement is, in two years of using MudBlazor I have never noticed the small footnote of responsive flex classes pinned at the bottom of the utilities section of the docs with 0 examples of using them. So maybe this whole PR should just be, hey here is how you can make MudStack responsive in the docs and then literally just add this example: <MudStack Row Class="flex-md-column">
<MudPaper Class="mud-theme-primary" Width="100%" Height="64px"/>
<MudPaper Class="mud-theme-secondary" Width="100%" Height="64px"/>
<MudPaper Class="mud-theme-secondary" Width="100%" Height="64px"/>
</MudStack> Because as I said, the only reason I want this is, because having a component that has no way to respond to the users screen size just seems crazy to me, but like you said, it can already be done... but how many other developers using So maybe this PR isn't needed, but better documentation on how to make components more responsive like I will say as a final note for discussion is, I still much prefer the idea of having Attributes like |
Honestly after thinking about it some more, I feel like a better way to just document components like <MudStack Class="flex-row flex-md-column">
<MudPaper Class="mud-theme-primary" Width="100%" Height="64px"/>
<MudPaper Class="mud-theme-secondary" Width="100%" Height="64px"/>
<MudPaper Class="mud-theme-secondary" Width="100%" Height="64px"/>
</MudStack> This has the advantage that newer users coming in will see and be able to reference these utility classes and without pointing out the Kind of a lie, I would still personally prefer an attribute like |
If we can break it down and simplify it as well as align the using of it so its in line with the rest of the library lets do it. MudStack != flexbox that's why there is utility classes and MudStack, MudStack is a very simple little tool for people to use. Its not meant to be flexbox wrapper. I wanted to offer both to our users since some, like you seem to know CSS very vell and others don't want to bother trying and using attributes in one way is better for them. I use MudStack everywhere, i think its really great and fast way to use flexbox, if i need something more i personally just add a utility class or i just go with div from the beginning. PS, i think ALL off our Flexbox utilities have breakpoints, and its mentioned on everysingle docs page. |
Sorry just to clarify, do you want me to update the PR to use And Yes, you are correct in saying your utility classes have breakpoint documentation, the part we might have had a miscommunication is that, I was saying nothing in any of the Component Documentations really references going to the CSS Utilities Documentation. It would be nice to see more examples using the CSS utilities to lead people there. I will be 100% honest, I rarely ever look at your CSS Utility, and when I did before making my css, I completely missed that section at the bottom, which is all on me. I don't believe is unrealistic to guess that most people using MudBlazor are not actively looking at that part of the Docs, which is on us consuming the library and not the developers or the people making the Docs, that's 100% on me and others not reading that section as throughly. |
Update the PR to use |
Yes. |
I will do that then! |
I forgot this was going to update this PR, I haven't finished my checking everything. But this does let me ask some questions for feedback. I added support for all options currently listed under the Breakpoint Enum, but I wasn't really sure if that is what you all would want as its not consistent with how you use Breakpoint inside MudTable, which doesn't really take into account the variations of so you know, review the concept and let me know as I look into fixing stuff that is likely to break because as I said, I forgot this was going to update the PR when I pushed my changes to my repo. Edit: also if I could have any sort of feedback on if I should use a function like in my current PR, or if I should do something like MudTable where its just |
Fix Tests and Formatting Mistakes
|
@Garderoben Does this look more like what you were expecting. Sorry about the ping, just wanted haven't seen any movement in two weeks and wanted confirmation. |
Sorry i missed this, I'm back next week i can test it out then |
Description
Using the breakpoint-specific properties: xs, sm, md, lg, xl, and xxl you can control when MudStack changes flex-direction. These properties allow developers to define different flex directions at various screen sizes, making the MudStack more adaptable and responsive across devices.
resolves #10586
How Has This Been Tested?
None, other then Docs implementation. Change adds a new Enum called
FlexDirection
and new css classes that use the formatflex-[row|row-reverse|column|column-reverse]-[xs|sm|md|lg|xl|xxl]
. Then it adds breakpoint specific attributes similar toMudItem
that allows developers to specify the flex direction at that breakpoint.I'll be happy to fix or make any changes. If this
Type of Changes
Checklist
dev
)..sln
files so I had to remove / readd the originals.*