Skip to content

Commit

Permalink
Update docs and stylint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Rozmus committed Apr 14, 2020
1 parent 6ebf1b1 commit 516740d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 4 deletions.
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
[![Greenkeeper badge](https://badges.greenkeeper.io/sandstreamdev/react-swipeable-list.svg)](https://greenkeeper.io/)
[![codecov](https://codecov.io/gh/sandstreamdev/react-swipeable-list/branch/master/graph/badge.svg)](https://codecov.io/gh/sandstreamdev/react-swipeable-list)
![GitHub Release Date](https://img.shields.io/github/release-date/sandstreamdev/react-swipeable-list)
[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors)

## React Swipeable List component

Expand Down Expand Up @@ -60,6 +60,32 @@ import '@sandstreamdev/react-swipeable-list/dist/styles.css';
</SwipeableList>
```

or use function as children pattern if other container is needed (check animation example)

```jsx
<SwipeableList>
{props => (
<TransitionGroup>
<CSSTransition>
<SwipeableListItem
swipeLeft={{
content: <div>Revealed content during swipe</div>,
action: () => console.info('swipe action triggered')
}}
swipeRight={{
content: <div>Revealed content during swipe</div>,
action: () => console.info('swipe action triggered')
}}
{...props}
>
<div>Item name</div>
</SwipeableListItem>
</CSSTransition>
</TransitionGroup>
)}
</SwipeableList>
```

## SwipeableList Props

### scrollStartThreshold
Expand Down Expand Up @@ -103,10 +129,30 @@ Data for defining left swipe action and rendering content after item is swiped.
```js
{
action, // required: swipe action (function)
actionAnimation, // optional: type of animation
content, // required: HTML or React component
}
```

#### action

Type: `function` (required)

Callback function that should be run when swipe is done beyond threshold.


#### actionAnimation

Type: `ActionAnimation (RETURN | REMOVE | NONE)` (optional, default: RETURN)

Animation type to be played swipe is done beyond threshold.

#### content

Type: `Anything that can be rendered` (required)

Content that is revealed when swiping.

### swipeRight

Type: `Object`
Expand Down
6 changes: 3 additions & 3 deletions src/SwipeableListItem.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}

.contentLeft {
composes: contentRight;
composes: contentRight; /* stylelint-disable-line */
justify-content: flex-end;
}

Expand All @@ -30,11 +30,11 @@
}

.contentLeftReturn {
composes: contentLeft return;
composes: contentLeft return; /* stylelint-disable-line */
}

.contentRightReturn {
composes: contentRight return;
composes: contentRight return; /* stylelint-disable-line */
}

.content {
Expand Down

0 comments on commit 516740d

Please sign in to comment.