Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Move Pagination to CSS framework #1157
Move Pagination to CSS framework #1157
Changes from 6 commits
a9b17cb
330539f
d112ead
a11e39b
9fae1cd
12fac8b
21d8def
6438973
ac5e6c9
946ac4b
dac4932
1956397
6f235c2
d3827b3
4b7bc63
7bb1df8
7dcfd60
1296853
d763d8c
627a1fa
7b5b219
34d97cb
61edc17
e3d66b3
7319cee
76e7af3
d28cbd4
076964c
446a000
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
@mpscholten this
default
implementation is very much Bootstrap framework, however I don't see much value at having a stripped of classes version, as it will never be used as-is. Do you agree?So
bootstrap
function will have no change, onlytailwind
willThere 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.
Another option that might be better is to break it down into smaller pieces, so bootsrap and tailwind will just have to define the classes.
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.
Agree
I just checked the tailwind docs and it looks like tailwind has a completly different dom structure for pagination. So I'd go with the first approach and just make bootstrap the default
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.
Could you add a couple of tests to the new functions? https://github.com/digitallyinduced/ihp/blob/master/Test/View/CSSFrameworkSpec.hs :)
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.
Why do we need a
cssFramework
property if we also callstyledPagination
withCSSFramework
? Seems that te pattern also withstyledFormField
we later end up calling
renderedHtml = styledPagination theCSSFramework theCSSFramework paginationView
. How manytheCSSFramework
do we need? 😅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.
Yeah, that's a bit tricky :) Basically we simulate late-binding from OOP here.
This code:
renderedHtml = styledPagination theCSSFramework theCSSFramework paginationView
Can also be written using
get
:That's important to understand here. We get a
styledPagination
function usingget #styledPagination theCSSFramework
.Then we apply
theCSSFramework
to that function. We apply thetheCSSFramework
to that function because thestyledPagination
function internally might want to call other functions of theCSSFramework
type. But you might want to override some functions of theCSSFramework
.Here's an example what would if we don't pass this a second time:
All good. But now as a user we want to override the button styling:
When we now render the
myPage
we will get<div><button style="color: red">button</button></div>
(a red button, while ourcustomCSS
specified it should be green).We can fix this by late-binding the calls by manually passing around a CSSFramework. Here I added a
CSSFramework
to all functions:Now we can customize it again:
I hope this clears things up.
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.
Super helpful, thanks - In fact I'll copy/ paste this explanation to
CSSFramework.hs