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 React from 'react'; | |
| import { AppProps } from 'next/app'; | |
| import { StyleSheetManager } from 'styled-components'; | |
| import { StylisPlugin } from 'styled-components'; | |
| import stylisRTLPlugin from 'stylis-plugin-rtl'; | |
| import { useTranslation } from 'react-i18next'; | |
| const App = (props: AppProps): JSX.Element => { | |
| const { Component, pageProps, router } = props; |
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 React, { useState } from "react"; | |
| const LEFT_TO_RIGHT_MARK = "\u200e"; // marks the input with LTR despite the specified direction | |
| function InputLTR() { | |
| const [cardNumber, setCardNumber] = useState(""); | |
| function onInputChange(event) { | |
| const newCardNumber = event.target.value.replace(LEFT_TO_RIGHT_MARK, ""); | |
| setCardNumber(newCardNumber); |
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 React from 'react'; | |
| import styled from 'styled-components'; | |
| const IconWrapper = styled('div')` | |
| html[dir='rtl'] &.flip-icon { | |
| transform: scaleX(-1); | |
| } | |
| `; | |
| const Icon = ({ name, onClick, noFlip }) => { |
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 { RefObject, useEffect, useState } from 'react'; | |
| import throttle from 'utils/throttle'; | |
| export default function useOnScreen( | |
| elementRef: RefObject<HTMLElement> | |
| ): boolean { | |
| const [isVisible, setIsVisible] = useState(false); | |
| const onScroll = throttle(() => { | |
| if (!elementRef.current) { |
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 { Dispatch, Reducer, useReducer } from 'react'; | |
| type Nullable<T> = T | null | undefined; | |
| type FetchMachineState<DataT, ErrorT> = { | |
| status: 'idle' | 'loading' | 'success' | 'failure'; | |
| data: Nullable<DataT>; | |
| error: Nullable<ErrorT>; | |
| }; |
NewerOlder