DefinitelyTyped/types/react-stickynode/react-stickynode-tests.tsx
Kamil Socha 57248c2857 [react-stickynode] Adjust 2.1 definitions (#41299)
* Adjust react-stickynode 2.1 definitions

* Fix version
2020-01-03 15:28:01 -08:00

47 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"
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>
);