Skip to content

Commit

Permalink
Add adjustment option for the width of the slider container via CSS c…
Browse files Browse the repository at this point in the history
…ustom property. (#29)

* Add adjustment option for the width of the slider container via CSS custom property.

* Changelog

* Adjust naming, add docs
  • Loading branch information
sneridagh authored Sep 20, 2023
1 parent c07a62f commit 698f403
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,19 @@ To workaround it, it's required to anchor the width to an external element that
```js
config.blocks.blocksConfig.slider = {
referenceContainerQuery: '.container .header',
referenceContainerQuery: 'body.has-sidebar .container .header',
};
```
This fix has an option to adjust this width given a fixed value of pixels via a CSS custom property called `--slider-block-edit-width-adjustment`.
So you can add it in your custom theme, as follows:
```css
:root {
--slider-block-edit-adjustment: 40px;
}
```
# Credits
<img alt="Forschungszentrum Jülich" src="https://github.com/kitconcept/volto-slider-block/raw/master/fz-juelich.svg" width="200px" />
Expand Down
1 change: 1 addition & 0 deletions news/29.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add adjustment option for the width of the slider container via CSS custom property. @sneridagh
2 changes: 1 addition & 1 deletion src/helpers/SlidesWidthFix/SlidesWidthFix.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const SlidesWidthFix = ({ width }) => {
{`
#page-add .block.slider .slick-slider,
#page-edit .block.slider .slick-slider {
width: ${width}px !important;
width: calc(${width}px - var(slider-block-edit-width-adjustment, 0px)) !important;
max-width: 1440px !important;
}`}
</style>
Expand Down

0 comments on commit 698f403

Please sign in to comment.