Skip to content

Commit

Permalink
use Text component
Browse files Browse the repository at this point in the history
  • Loading branch information
joshfarrant committed Nov 29, 2024
1 parent 1115a2b commit 30f41a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
12 changes: 2 additions & 10 deletions packages/react/src/forms/FormControl/FormControl.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,11 @@

.FormControl-hint {
grid-column: 1 / 3;
color: var(--brand-color-text-muted);
display: block;
font-size: var(--brand-text-size-100);
font-weight: var(--base-text-weight-regular);
letter-spacing: var(--brand-text-letterSpacing-100);
line-height: var(--brand-text-lineHeight-100);
}

/*Validation*/
.FormControl-validation {
font-weight: var(--base-text-weight-regular);
font-size: var(--brand-text-size-100);
line-height: var(--brand-text-lineHeight-100);
display: flex;
gap: var(--base-size-4);
}
Expand All @@ -93,12 +85,12 @@

.FormControl-validation-success-icon {
position: relative;
top: -1.6px;
top: -1px;
}

.FormControl-validation-error-icon {
position: relative;
top: -1px;
top: -0.5px;
}

.FormControl-validation--animate-in {
Expand Down
15 changes: 7 additions & 8 deletions packages/react/src/forms/FormControl/FormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {Select} from '../Select'
import {TextInput} from '../TextInput'
import {Textarea} from '../Textarea'
import {Radio} from '../Radio'
import {Text} from '../..'

import styles from './FormControl.module.css'

Expand Down Expand Up @@ -222,7 +223,9 @@ type FormControlValidationProps = {

const FormControlValidation = ({children, validationStatus, className, ...props}: FormControlValidationProps) => {
return (
<span
<Text
as="span"
size="100"
className={clsx(
styles['FormControl-validation'],
validationStatus && styles['FormControl-validation--animate-in'],
Expand All @@ -242,18 +245,14 @@ const FormControlValidation = ({children, validationStatus, className, ...props}
</span>
)}
{children}
</span>
</Text>
)
}

type FormControlHintProps = PropsWithChildren<BaseProps<HTMLSpanElement>>

const FormControlHint = ({children, className, ...rest}: FormControlHintProps) => {
return (
<span className={clsx(styles['FormControl-hint'], className)} {...rest}>
{children}
</span>
)
const FormControlHint = ({className, ...rest}: FormControlHintProps) => {
return <Text as="span" size="100" variant="muted" className={clsx(styles['FormControl-hint'], className)} {...rest} />
}

/**
Expand Down

0 comments on commit 30f41a3

Please sign in to comment.