Posted on 21/04/2023 14:54:16
Hi Kasper,
You have a few ways to go about it. I can't say there's a prefered way, as they have pros and cons, but let me speak about your examples specifically
General paddings
This comes with a cost. You can
- Create a custom css rule to override the default behavior of py-6
- I cringe at suggesting it, but it would prevent you from doing customizations all over, which would hinder your ability do do upgrades
- Edit the Item types and Templates
- You can edit the templates and the values associated with the item types.
- This requires some work, but also hinders your from doing upgrades easilly
- But it does allow you to honor the Bootstrap's proper css classes so it's not confusing to developers
- Do nothing
- Push back on the customer/designer and work within the boundaries of the options
- Although it seems very easy to add, having a smaller set of options helps the users no to get into choice overload. It also helps users to make easier and more consistent choices
- Although the HTML framework that supports Swift is Bootstrap 5.1, it may/could not be in the future, so it's also not interesting to have the options match every padding Bootstrap provides
- But then your design may not look at expected (or nice even)
I know some additiona features are in the works to make things like this a bit easier, but I can't speak into those.
That said, there is something to say about adding 1 more padding option OR some different options. Those requests come up including from me (when makes sense), but I am not supporting of extending this to everywhere.
Product Group Slider
This is a more common type of customization. You have a few options here (all with pros and cons)
- Change the item type and/or template directly
- This may make it harder on the upgrade Swift, but if you use Version Control, you can come back to it later and re-implement the change
- Create a new template for an existing Item type
- If you don't need to customize the Item type settings you can just create a copy of the template and then assign it in Apps > Websites > choose your website > Layout > Paragraph Layouts
Then just pick the custom template for the ProductGroupSlider item type
- Create a copy of the Item type
- You can also create a copy of the item type if you need to add additional fields
- You'll have to create a copy of the template as well, and if you name it exactly like the System name of the item type, DW can link them together automatically, otherwise check the bullet above
- You'll have to edit the restrictions of the Page item types where you want to use your new Item Type and enable it under "Allowed Children"
- This reduces your customization footprint, since it's limited to the restrictions on the Page Item Types, but you probably also can't automatically inherit any changes from upgrades
- Use Javascript
- I also cringe a bit at this suggestion too, but may be applicable in some scenarios to use javascript to add/remove css classes and/or some other modifications.
I can tell you we use Option 1 most of the times, and use the power of Git to do cherry-picks and re-implement the changes. That comes with a disciplined behavior of documenting the changes, so we can tell what's what when conflicts emerge.
Best Regards,
Nuno Aguiar