This file contains hidden or 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
| import * as React from 'react'; | |
| import { EnhanceCountDownPropsType, EnhanceCountDownStateType } from './types'; | |
| class EnhanceCountDown extends React.PureComponent< | |
| EnhanceCountDownPropsType, | |
| EnhanceCountDownStateType | |
| > { | |
| countDownInterval?: number; | |
| constructor(props: EnhanceCountDownPropsType) { |
This file contains hidden or 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
| export interface EnhanceCountDownPropsType { | |
| timeout: number; | |
| decreaseTimeout?: number; | |
| intervalTimeout?: number; | |
| children(props: InjectedCountDownProps): JSX.Element; | |
| } | |
| export interface EnhanceCountDownStateType { | |
| finished: boolean; | |
| pending: boolean; |
This file contains hidden or 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
| class App extends React.Component { | |
| constructor (props) { | |
| super(props) | |
| this.state = { name: '' } | |
| this.onChange = this.onChange.bind(this) | |
| } | |
| onChange (e) { | |
| this.setState({ name: e.target.value }) | |
| } |
This file contains hidden or 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
| module.exports = { | |
| parser: '@typescript-eslint/parser', // Specifies the ESLint parser | |
| extends: [ | |
| 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin | |
| 'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier | |
| 'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. | |
| ], | |
| parserOptions: { | |
| ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features | |
| sourceType: 'module', // Allows for the use of imports |
This file contains hidden or 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
| const axios = require("axios"); | |
| function getDependencies(packageName) { | |
| return new Promise(async (resolve, reject) => { | |
| if (!packageName) { | |
| reject(new Error("Missing package name.")); | |
| } | |
| try { | |
| const response = await axios.request({ | |
| method: "get", |
This file contains hidden or 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
| export interface OTPInputProps { | |
| length: number; // Number of inputs | |
| onChangeOTP: (otp: string) => any; // Handle onOTPChange to use its value | |
| autoFocus?: boolean; // Auto focus to input programmatically | |
| isNumberInput?: boolean; // If otp is number | |
| disabled?: boolean; | |
| style?: CSSProperties; // Style for container OTP | |
| className?: string; // Class for container OTP |
This file contains hidden or 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
| export function OTPInputComponent(props: OTPInputProps) { | |
| const { | |
| length, | |
| isNumberInput, | |
| autoFocus, | |
| disabled, | |
| onChangeOTP, | |
| inputClassName, | |
| inputStyle, | |
| ...rest |
This file contains hidden or 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
| <?php | |
| session_start(); | |
| if (!isset($_SESSION['shopping_cart'])) { | |
| $_SESSION['shopping_cart'] = array(); | |
| } | |
| $product_id = $_POST['id']; | |
| $product_name = $_POST['name']; |
This file contains hidden or 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
| // Handle onFocus input | |
| const handleOnFocus = useCallback( | |
| (index: number) => () => { | |
| focusInput(index); | |
| }, | |
| [focusInput] | |
| ); |
This file contains hidden or 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
| // Focus `inputIndex` input | |
| const focusInput = useCallback( | |
| (inputIndex: number) => { | |
| const selectedIndex = Math.max(Math.min(length - 1, inputIndex), 0); | |
| setActiveInput(selectedIndex); | |
| }, | |
| [length] | |
| ); |