Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce FormControl Hint and Validation font-size #831

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/lovely-berries-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@primer/react-brand': minor
---

Reduced size of text in `FormControl.Hint` and `FormControl.Validation` components

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 @@ -222,7 +223,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 @@ -242,17 +246,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.
Loading