Sortable - 图1

Sortable React Component

Sortable is not a separate component, but just a particular case of using and components.

Sortable Events

EventDescription
<List> events
The following events will be available on <List> when sortable prop enabled
sortableEnableEvent will be triggered when sortable mode is enabled
sortableDisableEvent will be triggered when sortable mode is disabled
sortableSortEvent will be triggered after user release currently sorting element in new position. event.detail will contain object with from and to properties with start/new index numbers of sorted list item

Examples

  1. export default () => (
  2. <Page>
  3. <Navbar title="Sortable List">
  4. <NavRight>
  5. <Link sortableToggle=".sortable">Toggle</Link>
  6. </NavRight>
  7. </Navbar>
  8. <Block>
  9. <p>Just click "Toggle" button on navigation bar to enable/disable sorting</p>
  10. </Block>
  11. <List sortable>
  12. <ListItem
  13. title="1 Jenna Smith"
  14. after="CEO">
  15. <Icon icon="icon-f7" slot="media"></Icon>
  16. </ListItem>
  17. <ListItem
  18. title="2 John Doe"
  19. after="Director">
  20. <Icon icon="icon-f7" slot="media"></Icon>
  21. </ListItem>
  22. <ListItem
  23. title="3 John Doe"
  24. after="Developer">
  25. <Icon icon="icon-f7" slot="media"></Icon>
  26. </ListItem>
  27. <ListItem
  28. title="4 Aaron Darling"
  29. after="Manager">
  30. <Icon icon="icon-f7" slot="media"></Icon>
  31. </ListItem>
  32. <ListItem
  33. title="5 Calvin Johnson"
  34. after="Accounter">
  35. <Icon icon="icon-f7" slot="media"></Icon>
  36. </ListItem>
  37. <ListItem
  38. title="6 John Smith"
  39. after="SEO">
  40. <Icon icon="icon-f7" slot="media"></Icon>
  41. </ListItem>
  42. <ListItem
  43. title="7 Chloe"
  44. after="Manager">
  45. <Icon icon="icon-f7" slot="media"></Icon>
  46. </ListItem>
  47. </List>
  48. <List mediaList sortable>
  49. <ListItem
  50. title="Yellow Submarine"
  51. after="$15"
  52. subtitle="Beatles"
  53. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  54. >
  55. <img slot="media" src="http://lorempixel.com/160/160/people/1" width="80" />
  56. </ListItem>
  57. <ListItem
  58. title="Don't Stop Me Now"
  59. after="$22"
  60. subtitle="Queen"
  61. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  62. >
  63. <img slot="media" src="http://lorempixel.com/160/160/people/2" width="80" />
  64. </ListItem>
  65. <ListItem
  66. title="Billie Jean"
  67. after="$16"
  68. subtitle="Michael Jackson"
  69. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
  70. >
  71. <img slot="media" src="http://lorempixel.com/160/160/people/3" width="80" />
  72. </ListItem>
  73. </List>
  74. </Page>
  75. );