Skip to content

Instantly share code, notes, and snippets.

@aplinxy9plin
Created May 11, 2019 13:17
Show Gist options
  • Select an option

  • Save aplinxy9plin/56dec2570f8339135a756c97b2d97aa3 to your computer and use it in GitHub Desktop.

Select an option

Save aplinxy9plin/56dec2570f8339135a756c97b2d97aa3 to your computer and use it in GitHub Desktop.
import React from 'react';
import { View, Panel, PanelHeader, Tabbar, TabbarItem } from '@vkontakte/vkui';
import Icon28Messages from '@vkontakte/icons/dist/28/messages'
import Icon28Search from '@vkontakte/icons/dist/28/search'
export default class App extends React.Component {
constructor (props) {
super(props);
this.state = {
activeStory: 'feed'
};
this.onStoryChange = this.onStoryChange.bind(this);
}
onStoryChange (e) {
this.setState({ activeStory: e.currentTarget.dataset.story })
}
render () {
return (
<Epic activeStory={this.state.activeStory} tabbar={
<Tabbar>
<TabbarItem
onClick={this.onStoryChange}
selected={this.state.activeStory === 'feed'}
data-story="feed"
text="Новости"
><Icon28Messages /></TabbarItem>
<TabbarItem
onClick={this.onStoryChange}
selected={this.state.activeStory === 'discover'}
data-story="discover"
text="Поиск"
><Icon28Search /></TabbarItem>
</Tabbar>
}>
<View id="feed" activePanel="feed">
<Panel id="feed">
<PanelHeader>Feed</PanelHeader>
</Panel>
</View>
<View id="discover" activePanel="discover">
<Panel id="discover">
<PanelHeader>Discover</PanelHeader>
</Panel>
</View>
</Epic>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment