pagination.stories.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import {Component} from 'react';
  2. import PropTypes from 'prop-types';
  3. import Pagination from 'sentry/components/pagination';
  4. export default {
  5. title: 'Components/Buttons/Pagination',
  6. component: Pagination,
  7. };
  8. const withBoth = `<https://sentry.io/api/0/organizations/sentry/issues/?cursor=1603798246000:0:1>; rel="previous"; results="true"; cursor="1603798246000:0:1",
  9. <https://sentry.io/api/0/organizations/sentry/issues/?cursor=1603719405000:0:0>; rel="next"; results="true"; cursor="1603719405000:0:0"
  10. `;
  11. const withNext = `<https://sentry.io/api/0/organizations/sentry/issues/?cursor=1603798246000:0:1>; rel="previous"; results="false"; cursor="1603798246000:0:1",
  12. <https://sentry.io/api/0/organizations/sentry/issues/?cursor=1603719405000:0:0>; rel="next"; results="true"; cursor="1603719405000:0:0"
  13. `;
  14. class Container extends Component {
  15. static childContextTypes = {
  16. location: PropTypes.object,
  17. };
  18. getChildContext() {
  19. return {location: window.location};
  20. }
  21. render() {
  22. return this.props.children;
  23. }
  24. }
  25. export const Default = () => {
  26. return (
  27. <Container>
  28. <div className="section">
  29. <h3>Both enabled</h3>
  30. <Pagination pageLinks={withBoth} />
  31. </div>
  32. <div className="section">
  33. <h3>Only next enabled</h3>
  34. <Pagination pageLinks={withNext} />
  35. </div>
  36. </Container>
  37. );
  38. };
  39. Default.storyName = 'Pagination';