Plugin Rail Advanced Customization #1843
shanearcaro
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Quick Introduction
I'm building a page editor as a side / hobby project and have never explored page editors / CMS frameworks libraries before. When I searched on google I came across Graph.js, Raka.js, payloadcms, and Puck.
After checking out Puck I was immediately impressed by the plugin system, overrides, theming, and the amount of customization the could be made. Once I finished looking at all the libraries I chose Puck based on how impressive the extensions and features are.
Background
All my customizations were going perfectly until I hit the plugin bar. My goal is to keep the general layout and structure of the core Puck editor so I was trying to avoid composition and stick with overrides.
Immediately I noticed there is no override for the plugin rail. After looking into the Plugin Bar Theming I also saw you can change the font size along with background and text colors of multiple properties but you could not change the width of the bar.
I looked around on the docs and could not find anyway to override the size of the plugin rail. This is when I started looking at composition and the feasibility of recreating the layout but the sidebar and other components are not exposed here either.
During my search I noticed a legacySideBarPlugin too, but this was not what I was looking for.
This is about the time when I gave up searching the docs and starting looking through the Github
Github
After searching I found two files that had the styles I needed: Nav Styles and Layout Styles
The important sections are:
Layout/styles.module.cssand
Nav/styles.module.cssI originally tried overriding these with normal css selectors but that didn't work because the generated component class names are transformed before being rendered:
What finally worked was a generous attribute selector:
I placed this inside a
/overrides/styles.cssfile and imported it afterglobals.csswithin the root layout and it worked perfectly!Conclusion
It would be very nice if the plugin rail became an overridable property where a component could be passed in to easily modify its properties similar to the other overrides. My solution feels very out of alignment with the extensiveness and customizability of Puck and it took me much longer than it probably should have to finally get it working.
All reactions