calendar.stories.js 1012 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import {useState} from 'react';
  2. import {DatePicker, DateRangePicker} from 'sentry/components/calendar';
  3. export default {
  4. title: 'Components/Calendar',
  5. };
  6. export const _DateRangePicker = () => {
  7. const [range, setRange] = useState({startDate: new Date(), endDate: new Date()});
  8. return (
  9. <DateRangePicker
  10. onChange={newRange => {
  11. setRange(newRange);
  12. }}
  13. startDate={range.startDate}
  14. endDate={range.endDate}
  15. />
  16. );
  17. };
  18. _DateRangePicker.storyName = 'DateRangePicker';
  19. _DateRangePicker.parameters = {
  20. docs: {
  21. description: {
  22. story: 'Calendar widget for selecting a date range. Uses react-date-range',
  23. },
  24. },
  25. };
  26. export const _DatePicker = () => {
  27. const [date, setDate] = useState(() => new Date());
  28. return <DatePicker date={date} onChange={setDate} />;
  29. };
  30. _DatePicker.storyName = 'DatePicker';
  31. _DatePicker.parameters = {
  32. docs: {
  33. description: {
  34. story: 'Calendar widget for selecting a single date. Uses react-date-range',
  35. },
  36. },
  37. };