Coder Social home page Coder Social logo

Comments (7)

SychO9 avatar SychO9 commented on June 26, 2024 1

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.

IndexPage

DiscussionPage

  • The way I see it, we would have an abstract ForumPage which has hero main sideNav content methods.
  • IndexPage extending ForumPage and implementing those methods.
  • TagsPage UserDirectoryPage ..etc extending IndexPage and implementing hero content.
  • DiscussionPage extending ForumPage and implementing hero main (or if possible preferably hero content sideNav)

Something like that, would still need to properly support adding the DiscussionList pane though.

Just writing down my thoughts.

from framework.

SychO9 avatar SychO9 commented on June 26, 2024 1

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.

stale avatar stale commented on June 26, 2024

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.

stale avatar stale commented on June 26, 2024

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.

askvortsov1 avatar askvortsov1 commented on June 26, 2024

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.

askvortsov1 avatar askvortsov1 commented on June 26, 2024

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.

SychO9 avatar SychO9 commented on June 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.