Skip to content
This repository has been archived by the owner on Feb 12, 2021. It is now read-only.

Commit

Permalink
Add withTouchProps and withMouseDownProps example
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Via Canel committed Jun 5, 2017
1 parent a089a9c commit e6114da
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/example/WithHoverPropsExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export default withHoverProps({ hovered: true })(function Focusable({ hovered, .
return (
<article {...props}>
<h1>withHoverProps</h1>
{hovered ? 'hovered!' : 'not hovered'}
{hovered ? 'hovered!' : 'hover the example to see it change'}
</article>
)
})`}</pre>
</code>
{hovered ? 'hovered!' : 'not hovered'}
{hovered ? 'hovered!' : 'hover the example to see it change'}
</article>
)
})
31 changes: 31 additions & 0 deletions src/example/WithMouseDownPropsExample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'
import { withMouseDownProps } from '../'

export default withMouseDownProps({ pressed: true })(function Pressable({ pressed, ...props }) {
return (
<article {...props}>
<h1>withMouseDownProps</h1>
<code>
<pre
style={{
color: 'lightgreen',
backgroundColor: 'black',
padding: 10,
overflowX: 'scroll',
}}
>{`import React from 'react'
import { withMouseDownProps } from '@klarna/higher-order-components'
export default withMouseDownProps({ pressed: true })(function Pressable({ pressed, ...props }) {
return (
<article {...props}>
<h1>withMouseDownProps</h1>
{pressed ? 'pressed!' : 'press anywhere to see it change'}
</article>
)
})`}</pre>
</code>
{pressed ? 'pressed!' : 'press anywhere to see it change'}
</article>
)
})
31 changes: 31 additions & 0 deletions src/example/WithTouchPropsExample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'
import { withTouchProps } from '../'

export default withTouchProps({ touched: true })(function Touchable({ touched, ...props }) {
return (
<article {...props}>
<h1>withTouchProps</h1>
<code>
<pre
style={{
color: 'lightgreen',
backgroundColor: 'black',
padding: 10,
overflowX: 'scroll',
}}
>{`import React from 'react'
import { withTouchProps } from '@klarna/higher-order-components'
export default withTouchProps({ touched: true })(function Touchable({ touched, ...props }) {
return (
<article {...props}>
<h1>withTouchProps</h1>
{touched ? 'touched!' : 'tap anywhere to see it change'}
</article>
)
})`}</pre>
</code>
{touched ? 'touched!' : 'tap anywhere to see it change'}
</article>
)
})
8 changes: 8 additions & 0 deletions src/example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import WithDeprecationWarningExample from './WithDeprecationWarningExample'
import WithDisplayNameExample from './WithDisplayNameExample'
import WithFocusPropsExample from './WithFocusPropsExample'
import WithHoverPropsExample from './WithHoverPropsExample'
import WithMouseDownPropsExample from './WithMouseDownPropsExample'
import WithTouchPropsExample from './WithTouchPropsExample'

const Example = ({ children }) => (
<div
Expand Down Expand Up @@ -56,6 +58,12 @@ const Page = componentQueries(
<Example>
<WithHoverPropsExample />
</Example>
<Example>
<WithMouseDownPropsExample />
</Example>
<Example>
<WithTouchPropsExample />
</Example>
</section>
</main>
))
Expand Down

0 comments on commit e6114da

Please sign in to comment.