Skip to content

Commit

Permalink
Finalised v3 React demos
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Jul 1, 2018
1 parent c43abfe commit 2f284ad
Show file tree
Hide file tree
Showing 8 changed files with 856 additions and 39 deletions.
260 changes: 257 additions & 3 deletions src/pug/docs-demos/react/swipeout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,269 @@ block content
super();

this.state = {

};
}
more() {
const self = this;
self.actions.open();
}
mark() {
const app = this.$f7;
app.dialog.alert('Mark');
}
reply() {
const app = this.$f7;
app.dialog.alert('Reply');
}
forward() {
const app = this.$f7;
app.dialog.alert('Forward');
}
onDeleted() {
const app = this.$f7;
app.dialog.alert('Thanks, item removed!');
}
onPageBeforeRemove() {
const self = this;
self.actions.destroy();
}
onPageInit() {
const self = this;
const app = self.$f7;
self.actions = app.actions.create({
buttons: [
[
{
text: 'Here comes some optional description or warning for actions below',
label: true,
},
{
text: 'Action 1',
},
{
text: 'Action 2',
},
],
[
{
text: 'Cancel',
bold: true,
},
],
],
});
}
render() {
return (
<App>
<View main>
<Page>

<Page onPageBeforeRemove={this.onPageBeforeRemove.bind(this)} onPageInit={this.onPageInit.bind(this)}>
<Navbar title="Swipeout"></Navbar>

<Block>
<p>
Swipe out actions on list elements is one of the most awesome F7 features. It allows you to call hidden menu for each list element where you can put default ready-to use delete button or any other buttons for some required actions.
</p>
</Block>

<BlockTitle>Swipe to delete with confirm modal</BlockTitle>
<List>
<ListItem
swipeout
title="Swipe left on me please">

<SwipeoutActions right>
<SwipeoutButton delete confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
</SwipeoutActions>
</ListItem>
<ListItem
swipeout
title="Swipe left on me too">

<SwipeoutActions right>
<SwipeoutButton delete confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
</SwipeoutActions>
</ListItem>
<ListItem
title="I am not removable">

</ListItem>
</List>

<BlockTitle>Swipe to delete without confirm</BlockTitle>
<List>
<ListItem
swipeout
title="Swipe left on me please">

<SwipeoutActions right>
<SwipeoutButton delete>Delete</SwipeoutButton>
</SwipeoutActions>
</ListItem>
<ListItem
swipeout
title="Swipe left on me too">

<SwipeoutActions right>
<SwipeoutButton delete>Delete</SwipeoutButton>
</SwipeoutActions>
</ListItem>
<ListItem
title="I am not removable">

</ListItem>
</List>

<BlockTitle>Swipe for actions</BlockTitle>
<List>
<ListItem
swipeout
title="Swipe left on me please">

<SwipeoutActions right>
<SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
<SwipeoutButton delete>Delete</SwipeoutButton>
</SwipeoutActions>
</ListItem>
<ListItem
swipeout
title="Swipe left on me too">

<SwipeoutActions right>
<SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
<SwipeoutButton delete>Delete</SwipeoutButton>
</SwipeoutActions>
</ListItem>
<ListItem
swipeout
title="You can't delete me">

<SwipeoutActions right>
<SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
</SwipeoutActions>
</ListItem>
</List>

<BlockTitle>With callback on remove</BlockTitle>
<List>
<ListItem
swipeout
onSwipeoutDeleted={this.onDeleted.bind(this)}
title="Swipe left on me please">

<SwipeoutActions right>
<SwipeoutButton delete>Delete</SwipeoutButton>
</SwipeoutActions>
</ListItem>
<ListItem
swipeout
onSwipeoutDeleted={this.onDeleted.bind(this)}
title="Swipe left on me too">

<SwipeoutActions right>
<SwipeoutButton delete>Delete</SwipeoutButton>
</SwipeoutActions>
</ListItem>
<ListItem
title="I am not removable">

</ListItem>
</List>

<BlockTitle>With actions on left side (swipe to right)</BlockTitle>
<List>
<ListItem
swipeout
title="Swipe right on me please">

<SwipeoutActions left>
<SwipeoutButton color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
<SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
</SwipeoutActions>
</ListItem>
<ListItem
swipeout
title="Swipe right on me too">

<SwipeoutActions left>
<SwipeoutButton color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
<SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
</SwipeoutActions>
</ListItem>
</List>

<BlockTitle>On both sides with overswipes</BlockTitle>
<List mediaList>
<ListItem
swipeout
title="Facebook"
after="17:14"
subtitle="New messages from John Doe"
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."
>
<SwipeoutActions left>
<SwipeoutButton overswipe color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
<SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
</SwipeoutActions>
<SwipeoutActions right>
<SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
<SwipeoutButton color="orange" onClick={this.mark.bind(this)}>Mark</SwipeoutButton>
<SwipeoutButton delete overswipe confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
</SwipeoutActions>
</ListItem>
<ListItem
swipeout
title="John Doe (via Twitter)"
after="17:11"
subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
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."
>
<SwipeoutActions left>
<SwipeoutButton overswipe color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
<SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
</SwipeoutActions>
<SwipeoutActions right>
<SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
<SwipeoutButton color="orange" onClick={this.mark.bind(this)}>Mark</SwipeoutButton>
<SwipeoutButton delete overswipe confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
</SwipeoutActions>
</ListItem>
<ListItem
swipeout
title="Facebook"
after="16:48"
subtitle="New messages from John Doe"
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."
>
<SwipeoutActions left>
<SwipeoutButton overswipe color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
<SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
</SwipeoutActions>
<SwipeoutActions right>
<SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
<SwipeoutButton color="orange" onClick={this.mark.bind(this)}>Mark</SwipeoutButton>
<SwipeoutButton delete overswipe confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
</SwipeoutActions>
</ListItem>
<ListItem
swipeout
title="John Doe (via Twitter)"
after="15:32"
subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
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."
>
<SwipeoutActions left>
<SwipeoutButton overswipe color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
<SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
</SwipeoutActions>
<SwipeoutActions right>
<SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
<SwipeoutButton color="orange" onClick={this.mark.bind(this)}>Mark</SwipeoutButton>
<SwipeoutButton delete overswipe confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
</SwipeoutActions>
</ListItem>
</List>
</Page>
</View>
</App>
Expand Down
36 changes: 34 additions & 2 deletions src/pug/docs-demos/react/swiper.pug
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,50 @@ block content
super();

this.state = {

};
}
render() {
return (
<App>
<View main>
<Page>

<Navbar title="Swiper" />
<BlockTitle>Minimal Layout</BlockTitle>
<Swiper>
<SwiperSlide>Slide 1</SwiperSlide>
<SwiperSlide>Slide 2</SwiperSlide>
<SwiperSlide>Slide 3</SwiperSlide>
</Swiper>

<BlockTitle>With all controls</BlockTitle>
<Swiper pagination navigation scrollbar>
<SwiperSlide>Slide 1</SwiperSlide>
<SwiperSlide>Slide 2</SwiperSlide>
<SwiperSlide>Slide 3</SwiperSlide>
</Swiper>

<BlockTitle>With additional parameters</BlockTitle>
<Swiper navigation params={{speed:500, slidesPerView: 3, spaceBetween: 20}}>
<SwiperSlide>Slide 1</SwiperSlide>
<SwiperSlide>Slide 2</SwiperSlide>
<SwiperSlide>Slide 3</SwiperSlide>
</Swiper>

<Block />
</Page>
</View>
</App>
)
}
}

style.
.swiper-slide {
background: #fff;
text-align: center;
font-size: 18px;
line-height: 200px;
box-sizing: border-box;
border: 1px solid #ccc;
}
Loading

0 comments on commit 2f284ad

Please sign in to comment.