DefinitelyTyped/types/react-stickynode/react-stickynode-tests.tsx
Mirosław Ciastek fdedaaf740
[react-stickynode] Update types to match version 3.0.2 (#45038)
* [react-stickynode] Update types to match version 3.0.2

* Fix spacing

* Fix version
2020-06-03 17:57:02 -07:00

48 lines
1.1 KiB
TypeScript

import * as Sticky from 'react-stickynode';
import * as React from 'react';
const StickyAllOptions: JSX.Element = (
<Sticky
enabled={true}
top={10}
bottomBoundary={120}
innerZ={1000}
enableTransforms={true}
activeClass="active"
releasedClass="released"
innerClass="innerClass"
onStateChange={s => s.status === Sticky.StatusCode.STATUS_ORIGINAL}
shouldFreeze={() => false}
>
<div />
</Sticky>
);
const StickyOptionalStringOptions: JSX.Element = (
<Sticky top="#elem" bottomBoundary="#bottom" innerZ="1234">
<div />
</Sticky>
);
const StickyNoOptions: JSX.Element = (
<Sticky>
<div />
</Sticky>
);
const StickyChildrenFunction: JSX.Element = (
<Sticky>
{status => {
if (status.status === Sticky.STATUS_FIXED) {
return 'the component is sticky';
}
if (status.status === Sticky.STATUS_ORIGINAL) {
return 'the component in the original position';
}
return 'the component is released';
}}
</Sticky>
);