vkui-no-connection-modal
v1.0.0
Published
<div align="center"> <img align="center" width="180" src="https://github.com/Aspedm/vkui-no-connection-modal/raw/master/readme_assets/no-connection.gif" /> <h2>VKUI NO INTERNET MODAL</h2> <blockquote> Simple UI component for show netwo
Readme
Features
- Supported all VKUI themes
- Auto close modal when user online
- Check connect when user try close modal
Install
yarn add vkui-no-connection-modalExample
import NoConnectionModal from 'vkui-no-connection-modal';
import useConnection from 'vkui-no-connection-modal/lib/useConnection';
const YourView = () => {
const [modal, setModal] = useState(null);
const isOnline = useConnection();
useEffect(() => {
if (!isOnline) return setModal(
<NoConnectionModal
onClose={() => setModal(null)}
/>
);
return setModal(null);
}, [isOnline]);
return (
<View activePanel="modals" modal={modal}>
<Panel id="modals">
<Group>
Your view
</Group>
</Panel>
</View>
);
};Options
You can passed options for component:
| Name | Type | Description | Default |
|---------------|----------|-------------|---------|
|header | string | Modal title | 'No internet'|
|subHeader | string | Modal description | 'Checking the network cables, modem and router.' |
|actionText | string | Button text | 'Try again' |
|onClose | function | Close modal function | Required |
Demo
Start storybook
yarn startContributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/featureName) - Commit your Changes (
git commit -m 'Add some featureName') - Push to the Branch (
git push origin feature/featureName) - Open a Pull Request
Credits
A big thanks to:
- VKUI - Component based on VKUI
