Comments (7)
I'm reopening this, it would actually be a huge improvement towards making Flarum's structure more customizable.
Currently, playing with the general structure is not impossible, but requires hacks and workarounds, which doesn't always work with custom extension pages. What I'd love to see, is a component that defines the general structure, and page components extending it would be just filling the gaps.
So I'm essentially not just talking about Pages that share the IndexPage's sidenav, but any forum page, including DiscussionPage.
Might be a bit of a challenge, because DiscussionPage is a little inconsistent, but I still think a minimum can be done.
- The way I see it, we would have an abstract
ForumPage
which hashero
main
sideNav
content
methods. IndexPage
extendingForumPage
and implementing those methods.TagsPage
UserDirectoryPage
..etc extendingIndexPage
and implementinghero
content
.DiscussionPage
extendingForumPage
and implementinghero
main
(or if possible preferablyhero
content
sideNav
)
Something like that, would still need to properly support adding the DiscussionList pane though.
Just writing down my thoughts.
from framework.
I think both composition and inheritance make sense here, the reason why inheritance I think should be used is:
If we define a ForumPage
, the view method would look something like this:
return (
<div className="ForumPage">
{this.hero()}
<div className="sideNavContainer">
<div className="sideNav">{this.sideNav()}</div>
<div className="sideNavOffset">{this.content()}</div>
</div>
</div>
);
This allows a theme for example to monkey patch it and reorganize that general structure, which is something I couldn't do when I tried or required hacks which didn't play nicely with extensions.
IndexPage can then have its sideNav
method use a IndexPageSideNav
component (or some naming along those lines), allowing other pages to properly use that sideNav instead of extending IndexPage just to use it or call it from its prototype.
from framework.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We do this to keep the amount of open issues to a manageable minimum.
In any case, thanks for taking an interest in this software and contributing by opening the issue in the first place!
from framework.
We are closing this issue as it seems to have grown stale. If you still encounter this problem with the latest version, feel free to re-open it.
from framework.
I'm not so sure that we want to go down the inheritance route. I think it might be better if we made Hero and the IndexPage nav its own components, so reusing them would be a lot more flexible. For example, the blog extension doesn't use this ForumPage
layout.
I think composition + documentation would be more flexible than forcing an inheritance structure.
from framework.
That's a good point, I like this approach!
Another thing we might want to consider is that at the core, most pages are structured as a horizontal "hero", with the rest of the page being organized into parallel columns. We could try to generalize sideNavContainer
to somehow make this simpler / more extensible (for instance, a third column ala dev.to)?
from framework.
Oh interesting idea, you mean if a page wanted to have more than two columns right ? since the code I wrote above only takes into account two columns. The thing is a page would still be able to have more columns if need be, the content itself would use a sideNavContainer class (with another sideNav and sideNavOffset) and I think that's a good approach, since the page would have complete control over these additional columns, while our initial sideNav would remain that special kind of column.
Although, we don't have real examples of something like that yet, so not sure, but we can always keep improving, as long as we start from somewhere.
from framework.
Related Issues (20)
- Search drivers HOT 2
- typo in js part of sticky plugin HOT 5
- Missing Component Exports
- DispatchEventsTrait causes error when event does not have "actor" attribute due to PHP 8.2 deprecation HOT 4
- Setting permissions on mobile does not display correctly on mobile
- PostRepository::getIndexForNumber() walks 2 time the posts table to get offset HOT 6
- Code blocks are hard to read in dark mode HOT 2
- [1.x] `Conditional` extender instantiates the extenders array even when the conditional is false
- Support Invokable Classes in Console Extender's schedule method
- Akismet False Positives Triggered by Flag Removal
- Empty settings don't return default values HOT 13
- Content max limit is incorrect HOT 2
- [2.x] `LogoutController` permits open redirects
- Height of Modals on Mobile Inconsistent
- fttb slow response time
- Invisible buttons when making primary color #ffffff
- Admin page's Save button won't reset if an error occurs HOT 1
- JSON:API Layer Refactor HOT 3
- Cryptograhpically Sign releases HOT 9
- [Pusher] New notifications count increment doesnt work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.