Source

components/extras/NeedLogin.tsx

import * as React from 'react'
import { Alert, AlertType } from './Alert'

type NeedLoginProps = {
	/** If true, the prompt refers to a function, otherwise refers to entire application */
	specific?: boolean
}

/**
 * An alert box that specifies that login is required to access either the entire application, or if `specific` is set,
 * access to a function instead.
 *
 * NeedLogin, application level example:
 * ```tsx
 * <NeedLogin/>
 * ```
 *
 * NeedLogin, function level example:
 * ```tsx
 * <NeedLogin specific={true}/>
 * ```
 * @component
 * @category Extras
 */
export const NeedLogin = ({ specific }: NeedLoginProps) => {
	return <Alert type={AlertType.WARNING}>Please login to access this {specific ? 'function' : 'application'}.</Alert>
}