Skip to content

Commit

Permalink
Reduce FormControl Hint and Validation font-size (#831)
Browse files Browse the repository at this point in the history
* reduce FormControl Hint and Validation font-size to 100

* reduce FormControl Hint and Validation line-height to 100

* reduce FormControl Hint letter-spacing to 100

* github-actions[bot] Regenerated snapshots

* add changeset

* use Text component

* update snapshots

* update changeset

---------

Co-authored-by: joshfarrant <[email protected]>
  • Loading branch information
joshfarrant and joshfarrant authored Dec 5, 2024
1 parent 1f9eb72 commit 8c3448d
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/lovely-berries-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react-brand': minor
---

Reduced the text size in `FormControl.Hint` and `FormControl.Validation` components to match their counterparts in `CheckboxGroup` and `RadioGroup` for improved consistency and visual design accuracy.
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-200);
font-weight: var(--base-text-weight-regular);
letter-spacing: var(--brand-text-letterSpacing-200);
line-height: var(--brand-text-lineHeight-200);
}

/*Validation*/
.FormControl-validation {
font-weight: var(--base-text-weight-regular);
font-size: var(--brand-text-size-200);
line-height: var(--brand-text-lineHeight-200);
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
21 changes: 15 additions & 6 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 '../../Text'

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

Expand Down Expand Up @@ -221,7 +222,10 @@ type FormControlValidationProps = {

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

type FormControlHintProps = PropsWithChildren<BaseProps<HTMLSpanElement>>

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

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8c3448d

Please sign in to comment.