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"; | |
// * modules | |
import classnames from "classnames"; | |
import { Tooltip } from "antd"; | |
// define all text types | |
type VariantProps = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p"; | |
type LineheightProps = | |
| "none" |
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
function isPropsForTextareaElement( | |
props: InputProps | TextareaProps | |
): props is TextareaProps { | |
return "rows" in props; | |
} | |
export const TextareaInputGeneralComponent = ( | |
props: InputProps | TextareaProps | |
) => { | |
if (isPropsForTextareaElement(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
const Register: FC = props => { | |
const formRef = useRef<ImperativeHandleProps>(null!); | |
return ( | |
<Fragment> | |
<Form ref={formRef} /> | |
<button onClick={() => formRef.current.onSomePropFired()}> | |
sbt form | |
</button> | |
</Fragment> | |
); |
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, { FC, Fragment } from "react"; | |
import { usePermissions } from "services/rbac"; | |
import { get } from "lodash"; | |
export type AclProps = { | |
permission: string; | |
}; | |
export const AclService: FC<AclProps> = ({ permission, children }) => { | |
const { role, permissions } = usePermissions(); |
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 { generatePath } from "react-router-dom"; | |
import { stringify } from "qs"; | |
import get from "lodash/get"; | |
import __ROUTES__ from "constants/routes"; | |
type PathType = keyof typeof __ROUTES__; | |
type ParamsType = { [paramName: string]: string | number | boolean }; | |
export const routeTo = ( | |
path: PathType, |
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
/** | |
* Picked from https://github.com/microsoft/fluentui | |
* Simulated enum for keycodes. These will get inlined by uglify when used much like an enum | |
* | |
* @public | |
* {@docCategory KeyCodes} | |
*/ | |
export const KeyCodes = { | |
backspace: 8 as 8, | |
tab: 9 as 9, |
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
// This one is picked from https://github.com/piotrwitek/react-redux-typescript-guide | |
import React from 'react'; | |
const MISSING_ERROR = 'Error was swallowed during propagation.'; | |
export const withErrorBoundary = <BaseProps extends {}>( | |
BaseComponent: React.ComponentType<BaseProps> | |
) => { | |
type HocProps = { |
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 { AxiosRequestConfig, AxiosInstance } from "axios"; | |
interface AuthRequestConfig { | |
/** | |
* @default true | |
*/ | |
shouldAuthenticate?: boolean; | |
} | |
declare module "axios" { |
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
// This part is picked from the `fluentui` repo -> https://github.com/microsoft/fluentui | |
export let _isSSR = false; | |
/** | |
* Helper to set ssr mode to simulate no window object returned from getWindow helper. | |
* | |
* @public | |
*/ | |
export function setSSR(isEnabled: boolean): void { |