mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 05:41:33 +02:00
* Remove focused style from the stepper * Reduce spacing between password input and password policy * Make input validation icon larger * Make animated-tick.svg faster * Move notification to below h1 * Move notification to below h1 * Fix: Warning: Invalid DOM property `autocomplete`. Did you mean `autoComplete`? * Wrap form-text in a span so it's displayed correctly and not altered by flex * Remove "Please request a new password reset email and follow the link." text after the email is entered * Remove (unnecessary?) flex property on .ciam-form-text-icon * Rename `messageTextNode` to `messageTextSpan` * Revert changes to input-validator.ts GitOrigin-RevId: ad83c92a59b9dbc872cf4e49362b0baec9fb5b93
60 lines
1.3 KiB
TypeScript
60 lines
1.3 KiB
TypeScript
import { Form, FormTextProps as BS5FormTextProps } from 'react-bootstrap'
|
|
import classnames from 'classnames'
|
|
import { MergeAndOverride } from '@ol-types/utils'
|
|
import { CheckCircle, WarningCircle } from '@phosphor-icons/react'
|
|
|
|
type TextType = 'success' | 'error'
|
|
|
|
export type FormTextProps = MergeAndOverride<
|
|
BS5FormTextProps,
|
|
{
|
|
type?: TextType
|
|
marginless?: boolean
|
|
}
|
|
>
|
|
|
|
const typeClasses = {
|
|
error: 'text-danger',
|
|
success: 'text-success',
|
|
} as const
|
|
|
|
export const getFormTextClass = (type?: TextType) =>
|
|
type && type in typeClasses
|
|
? typeClasses[type as keyof typeof typeClasses]
|
|
: undefined
|
|
|
|
function FormTextIcon({ type }: { type?: TextType }) {
|
|
switch (type) {
|
|
case 'success':
|
|
return <CheckCircle className="ciam-form-text-icon" />
|
|
case 'error':
|
|
return <WarningCircle className="ciam-form-text-icon" />
|
|
default:
|
|
return null
|
|
}
|
|
}
|
|
|
|
function DSFormText({
|
|
type,
|
|
marginless,
|
|
children,
|
|
className,
|
|
...rest
|
|
}: FormTextProps) {
|
|
return (
|
|
<Form.Text
|
|
className={classnames('form-text-ds', className, getFormTextClass(type), {
|
|
marginless,
|
|
})}
|
|
{...rest}
|
|
>
|
|
<span className="form-text-inner-ds">
|
|
<FormTextIcon type={type} />
|
|
<span>{children}</span>
|
|
</span>
|
|
</Form.Text>
|
|
)
|
|
}
|
|
|
|
export default DSFormText
|