Skip to content

Commit

Permalink
Add ripple documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
javivelasco committed Dec 20, 2015
1 parent 6cc95c5 commit 055c6e3
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
27 changes: 27 additions & 0 deletions components/ripple/readme.md
@@ -0,0 +1,27 @@
# Ripple

The ripple is a surface reaction that happens when the user interacts with the component. It's useful to provide feedback about a click or touch action. In React Toolbox it's implemented as an higher order component (HOC) being a requirement for the child to implement `children` and `onMouseDown` props. Also it should be placed as relative. Hiding the overflow is up to you.

<!-- example -->
```jsx
import Ripple from 'react-toolbox/lib/ripple';

const Link = (props) => (
<a {...props} style={{position: 'relative'}}>
{props.children}
</a>
);

const RippleLink = Ripple({spread: 3})(Link);
const RippleTest = () => <RippleLink href='#'>Test</RippleLink>;
```

## Properties

In any component you decorate with the Ripple you'd get some additional props:

| Name | Type | Default | Description|
|:-----|:-----|:-----|:-----|
| `centered` | `Boolean` | `false` | True in case you want a centered ripple.|
| `className` | `String` | `''` | String to customize appearance (color and opacity for example).|
| `spread` | `Number` | `2` | Factor to indicate how much should the ripple spread under the component. |
8 changes: 8 additions & 0 deletions docs/app/components/layout/main/modules/components.js
Expand Up @@ -17,6 +17,7 @@ import Menu from 'react-toolbox/menu/readme';
import Navigation from 'react-toolbox/navigation/readme';
import ProgressBar from 'react-toolbox/progress_bar/readme';
import RadioGroup from 'react-toolbox/radio/readme';
import Ripple from 'react-toolbox/ripple/readme';
import Slider from 'react-toolbox/slider/readme';
import Snackbar from 'react-toolbox/snackbar/readme';
import Switch from 'react-toolbox/switch/readme';
Expand Down Expand Up @@ -44,6 +45,7 @@ import NavigationExample1 from './examples/navigation_example_1.txt';
import ProgressBarExample1 from './examples/progressbar_example_1.txt';
import RadioExample1 from './examples/radio_example_1.txt';
import SliderExample1 from './examples/slider_example_1.txt';
import RippleExample1 from './examples/ripple_example_1.txt';
import SnackbarExample1 from './examples/snackbar_example_1.txt';
import SwitchExample1 from './examples/switch_example_1.txt';
import TableExample1 from './examples/table_example_1.txt';
Expand Down Expand Up @@ -159,6 +161,12 @@ export default {
path: '/components/radio_group',
examples: [RadioExample1]
},
ripple: {
name: 'Ripple',
docs: Ripple,
path: '/components/ripple',
examples: [RippleExample1]
},
slider: {
name: 'Slider',
docs: Slider,
Expand Down
@@ -0,0 +1,10 @@
const CustomLink = (props) => (
<a {...props} style={{position: 'relative'}}>
{props.children}
</a>
);

const RippleLink = Ripple({spread: 3})(CustomLink);
const RippleTest = () => <RippleLink>Test</RippleLink>;

return <RippleTest />;

0 comments on commit 055c6e3

Please sign in to comment.