-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Aspedm/feature/vkui4
VKUI 4 and Typescript
- Loading branch information
Showing
19 changed files
with
1,019 additions
and
487 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-env", | ||
"@babel/preset-react" | ||
"@babel/preset-react", | ||
"@babel/preset-typescript" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"rules": { | ||
"@typescript-eslint/ban-ts-ignore": ["off"], | ||
"@typescript-eslint/camelcase": ["off"], | ||
"@typescript-eslint/explicit-function-return-type": ["off"], | ||
"@typescript-eslint/interface-name-prefix": ["off"], | ||
"@typescript-eslint/no-explicit-any": ["off"], | ||
"@typescript-eslint/no-unused-expressions": ["off"], | ||
"@typescript-eslint/no-var-requires": ["off"], | ||
"no-use-before-define": "off", | ||
"@typescript-eslint/no-use-before-define": ["error"], | ||
"comma-dangle": ["error", "always-multiline"], | ||
"no-async-promise-executor": ["off"], | ||
"no-empty-pattern": ["off"], | ||
"no-undef": ["error"], | ||
"no-var": ["error"], | ||
"object-curly-spacing": ["error", "always"], | ||
"quotes": ["error", "double", { "allowTemplateLiterals": true }], | ||
"semi": ["error", "always"], | ||
"spaced-comment": ["off"], | ||
"no-prototype-builtins": ["off"], | ||
"sort-keys": ["off"], | ||
"space-before-function-paren": ["off"], | ||
"indent": [2, "tab"], | ||
"no-tabs": 0 | ||
}, | ||
"env": { | ||
"browser": true, | ||
"es6": true | ||
}, | ||
"extends": [ | ||
"standard", | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["prettier", "@typescript-eslint"] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from "react"; | ||
export interface ConnectionDetectModalProps { | ||
header?: string; | ||
subHeader?: string; | ||
actionText?: string; | ||
onClose: () => void; | ||
} | ||
declare const ConnectionDetectModal: React.FC<ConnectionDetectModalProps>; | ||
export default ConnectionDetectModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare const T_REX_ICON: string; | ||
export default T_REX_ICON; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* @returns {boolean} | ||
*/ | ||
declare const UseConnection: () => boolean; | ||
export default UseConnection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
declare module "*.svg" { | ||
const content: any; | ||
export default content; | ||
} | ||
|
||
declare module "\*.png" { | ||
const content: string; | ||
export default content; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React, { useState } from "react"; | ||
import { ModalRoot, ModalCard, Spinner, Button } from "@vkontakte/vkui"; | ||
import T_REX_ICON from "./assets/icon"; | ||
|
||
export interface ConnectionDetectModalProps { | ||
header?: string; | ||
subHeader?: string; | ||
actionText?: string; | ||
onClose: () => void; | ||
} | ||
|
||
const MODAL_INFO_ID = "modal-root-info"; | ||
|
||
const ConnectionDetectModal: React.FC<ConnectionDetectModalProps> = ({ header, subHeader, actionText, onClose }) => { | ||
const [checkProgress, setCheckProgress] = useState(false); | ||
|
||
/** | ||
* @returns {void} | ||
*/ | ||
const checkConnection = (): void => { | ||
const online: boolean = navigator.onLine; | ||
setCheckProgress(true); | ||
|
||
if (!online) { | ||
const timeout = setTimeout(() => { | ||
setCheckProgress(false); | ||
clearTimeout(timeout); | ||
}, 1000); | ||
|
||
return; | ||
} | ||
|
||
return onClose(); | ||
}; | ||
|
||
return ( | ||
<ModalRoot activeModal={MODAL_INFO_ID} onClose={checkConnection}> | ||
<ModalCard | ||
id={MODAL_INFO_ID} | ||
onClose={checkConnection} | ||
icon={<img src={T_REX_ICON} alt="Trex" style={{ width: 160 }} />} | ||
header={header} | ||
subheader={subHeader} | ||
actions={ | ||
<Button | ||
size="l" | ||
mode="primary" | ||
onClick={() => checkConnection()} | ||
> | ||
{checkProgress ? <Spinner size="small" /> : actionText} | ||
</Button> | ||
} | ||
/> | ||
</ModalRoot> | ||
); | ||
}; | ||
|
||
ConnectionDetectModal.defaultProps = { | ||
header: "No internet", | ||
subHeader: "Checking the network cables, modem and router.", | ||
actionText: "Try again", | ||
}; | ||
|
||
export default ConnectionDetectModal; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.