-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add
boundsPadding
documentation and examples
- Loading branch information
Showing
4 changed files
with
70 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Meta, Preview, Props, Story } from '@storybook/addon-docs/blocks'; | ||
|
||
import { ReactCompareSlider, ReactCompareSliderImage } from 'react-compare-slider'; | ||
|
||
import { Default } from './demos/01-Images.story'; | ||
|
||
<Meta title="Docs/Bounds Padding" component={ReactCompareSlider} argTypes={Default.args} /> | ||
|
||
# Using `BoundsPadding` | ||
|
||
- [ReactCompareSliderImage](<#reactcomparesliderimage>) | ||
- [Live Examples](<#live-examples>) | ||
|
||
The `boundsPadding` prop allows you to limit the slideable area on the Y-axis | ||
in `portrait` mode or on the X-axis in the default landscape mode. The default | ||
`boundsPadding` value is `0`, negative values are treated the same as `0` and | ||
the value **MUST** be supplied as a number in pixels. | ||
|
||
Bounds padding is useful when the slider has other components overlaying it - e.g. in a full | ||
width/height carousel with previous and next buttons which you don't want the slider | ||
handle to going behind. | ||
|
||
In the example below, bounds padding prevents the slider handle from going | ||
within range of pixels of the left or right of the slider specified by the `boundsPadding` prop. The bounds are automatically | ||
applied to the top/bottom or right/left depending on the orientation of the slider. | ||
|
||
```JSX | ||
boundsPadding={100} | ||
``` | ||
|
||
<Preview> | ||
<Story id="demos-images--bounds-padding" /> | ||
</Preview> | ||
|
||
<Props of={ReactCompareSlider} /> | ||
|
||
<br /> | ||
|
||
## Live Examples | ||
|
||
Checkout the [Bounds padding demos](?path=/story/demos-images--bounds-padding) to experiment with images. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters