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 89831d8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 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
2 changes: 1 addition & 1 deletion packages/react/src/forms/FormControl/FormControl.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {render, cleanup} from '@testing-library/react'
import React, {render, cleanup, prettyDOM} from '@testing-library/react'

Check failure on line 1 in packages/react/src/forms/FormControl/FormControl.test.tsx

View workflow job for this annotation

GitHub Actions / Next.js

'prettyDOM' is defined but never used

Check failure on line 1 in packages/react/src/forms/FormControl/FormControl.test.tsx

View workflow job for this annotation

GitHub Actions / Install and run tests

'prettyDOM' is defined but never used
import '@testing-library/jest-dom'
import {axe, toHaveNoViolations} from 'jest-axe'

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 89831d8

Please sign in to comment.