Skip to content

Commit

Permalink
Improve consistency and terseness, follow guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentSmedinga committed May 15, 2024
1 parent ad932d1 commit da99c5f
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 32 deletions.
1 change: 1 addition & 0 deletions documentation/storybook.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Be sure to follow these guidelines when you do:

1. Add a `description` field instead of a JSDoc comment for native HTML attributes.
Use terse sentences that end with a full stop.
When adding a prop, check for an corresponding existing prop and copy its description.
2. When mentioning a component, write its name in title case, e.g. ‘Card’ or ‘Form Field’.
This represents the component more strongly and helps users recognise them as such.
3. For props offering five options or less, use radio buttons rather than a select.
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/Accordion/AccordionSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { getHeadingElement } from '../Heading/getHeadingElement'
import { Icon } from '../Icon/Icon'

export type AccordionSectionProps = {
/** The heading for this section of the accordion. */
/** The heading text. */
label: string
/** Whether the section initially shows its content. */
/** Whether the content is displayed initially. */
expanded?: boolean
} & PropsWithChildren<HTMLAttributes<HTMLElement>>

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { IconButton } from '../IconButton'
export type AlertProps = {
/** Whether the user can dismiss the Alert. Adds a button to its top right. */
closeable?: boolean
/** The hierarchical level of the Heading within the document. */
/** The hierarchical level of the Alert’s Heading within the document. */
headingLevel?: HeadingProps['level']
/** A function to run when dismissing. */
onClose?: () => void
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Blockquote/Blockquote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { forwardRef } from 'react'
import type { BlockquoteHTMLAttributes, ForwardedRef, PropsWithChildren } from 'react'

export type BlockquoteProps = {
/** Changes the text color for readability on a dark background. */
/** Changes the text colour for readability on a dark background. */
inverseColor?: boolean
} & PropsWithChildren<BlockquoteHTMLAttributes<HTMLQuoteElement>>

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Breadcrumb/BreadcrumbItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { forwardRef } from 'react'
import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react'

export type BreadcrumbItemProps = {
/** The url for the link on this breadcrumb item. */
/** The url for the link. */
href: string
} & PropsWithChildren<HTMLAttributes<HTMLLIElement>>

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/DescriptionList/DescriptionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { DescriptionListDetails } from './DescriptionListDetails'
import { DescriptionListTerm } from './DescriptionListTerm'

export type DescriptionListProps = {
/** Changes the text color for readability on a dark background. */
/** Changes the text colour for readability on a dark background. */
inverseColor?: boolean
} & PropsWithChildren<HTMLAttributes<HTMLDListElement>>

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Heading } from '../Heading'
import { IconButton } from '../IconButton'

export type DialogProps = {
/** The list of buttons for this dialog. Start with a primary button. */
/** The list of buttons. Start with a primary button. */
actions?: ReactNode
} & PropsWithChildren<DialogHTMLAttributes<HTMLDialogElement>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { forwardRef } from 'react'
import type { ForwardedRef, HTMLAttributes } from 'react'

export type FormFieldCharacterCounterProps = HTMLAttributes<HTMLDivElement> & {
/** The current length of the field’s content. */
/** The current length of the field’s value. */
length: number
/** The maximum length of the field’s content. */
/** The maximum length of the field’s value. */
maxLength: number
}

Expand Down
8 changes: 4 additions & 4 deletions packages/react/src/Grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ export type GridPaddingSize = 'small' | 'medium' | 'large'
type GridPaddingVerticalProp = {
paddingBottom?: never
paddingTop?: never
/** The amount of vertical white space above and below. */
/** The amount of space above and below. */
paddingVertical?: GridPaddingSize
}

type GridPaddingTopAndBottomProps = {
/** The amount of vertical white space below. */
/** The amount of space below. */
paddingBottom?: GridPaddingSize
/** The amount of vertical white space above. */
/** The amount of space above. */
paddingTop?: GridPaddingSize
paddingVertical?: never
}

export type GridProps = {
/** The amount of vertical white space between rows. */
/** The amount of space between rows. */
gapVertical?: 'none' | 'small' | 'large'
} & (GridPaddingVerticalProp | GridPaddingTopAndBottomProps) &
PropsWithChildren<HTMLAttributes<HTMLDivElement>>
Expand Down
8 changes: 4 additions & 4 deletions packages/react/src/Heading/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export type HeadingLevel = 1 | 2 | 3 | 4
type HeadingSize = 'level-1' | 'level-2' | 'level-3' | 'level-4' | 'level-5' | 'level-6'

export type HeadingProps = {
/** The hierarchical level of the heading. */
/** Changes the text colour for readability on a dark background. */
inverseColor?: boolean
/** The hierarchical level within the document. */
level?: HeadingLevel
/** Makes the title larger or smaller without changing its position in the heading hierarchy. */
/** Uses larger or smaller text without changing its position in the heading hierarchy. */
size?: HeadingSize
/** Changes the text color for readability on a dark background. */
inverseColor?: boolean
} & PropsWithChildren<HTMLAttributes<HTMLHeadingElement>>

export const Heading = forwardRef(
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { VisuallyHidden } from '../VisuallyHidden'
export type IconButtonProps = {
/** The accessible text for the icon. Will be read out by screen readers. Should describe the button’s action. */
label: string
/** The background colour on which the icon button sits. Allows the icon to provide visual contrast. */
/** Describes the underlying background colour. Allows the icon to provide visual contrast. */
onBackground?: 'light' | 'dark'
/** The size of the icon. Corresponds with the text levels. */
size?: 'level-3' | 'level-4' | 'level-5' | 'level-6'
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Link/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type LinkOnBackground = 'default' | 'light' | 'dark'
type LinkVariant = 'standalone' | 'inline'

export type LinkProps = {
/** The background colour on which the link sits. Allows the text to provide visual contrast. */
/** Describes the underlying background colour. Allows the text to provide visual contrast. */
onBackground?: LinkOnBackground
/** Whether the link is inline or stands alone. */
variant?: LinkVariant
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/LinkList/LinkListLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import { Icon } from '../Icon'
type BackgroundName = 'default' | 'light' | 'dark'

export type LinkListLinkProps = {
/** The target url for the link. */
/** The url for the link. */
href: string
/** An icon to display instead of the default chevron. Don’t mix custom icons with chevrons in one list. */
icon?: Function
/** Whether the link sits on a dark background. */
/** Describes the underlying background colour. Allows the text to provide visual contrast. */
onBackground?: BackgroundName
/** The text size for the link. Use the same size for all items in the list. */
/** The size of the text. Use the same size for all items in the list. */
size?: 'small' | 'large'
} & PropsWithChildren<AnchorHTMLAttributes<HTMLAnchorElement>>

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/OrderedList/OrderedList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import type { ForwardedRef, OlHTMLAttributes, PropsWithChildren } from 'react'
import { OrderedListItem } from './OrderedListItem'

export type OrderedListProps = {
/** Changes the text color for readability on a dark background. */
/** Changes the text colour for readability on a dark background. */
inverseColor?: boolean
/** Whether the list items show a marker. */
markers?: boolean
/** The text size for the ordered list */
/** The size of the text. */
size?: 'small'
} & PropsWithChildren<OlHTMLAttributes<HTMLOListElement>>

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/PageHeading/PageHeading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { forwardRef } from 'react'
import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react'

export type PageHeadingProps = {
/** Changes the text color for readability on a dark background. */
/** Changes the text colour for readability on a dark background. */
inverseColor?: boolean
} & PropsWithChildren<HTMLAttributes<HTMLHeadingElement>>

Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/Paragraph/Paragraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { forwardRef } from 'react'
import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react'

export type ParagraphProps = {
/** The text size for the paragraph. */
size?: 'small' | 'large'
/** Changes the text color for readability on a dark background. */
/** Changes the text colour for readability on a dark background. */
inverseColor?: boolean
/** The size of the text. */
size?: 'small' | 'large'
} & PropsWithChildren<HTMLAttributes<HTMLParagraphElement>>

export const Paragraph = forwardRef(
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/TextArea/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { forwardRef } from 'react'
import type { ForwardedRef, TextareaHTMLAttributes } from 'react'

export type TextAreaProps = TextareaHTMLAttributes<HTMLTextAreaElement> & {
/** Allows the user to resize the text box. The default enables resizing in both directions. */
/** Allows the user to resize the text box. The default is resizing in both directions. */
resize?: 'none' | 'horizontal' | 'vertical'
}

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/UnorderedList/UnorderedList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import type { ForwardedRef, HTMLAttributes, PropsWithChildren } from 'react'
import { UnorderedListItem } from './UnorderedListItem'

export type UnorderedListProps = {
/** Changes the text color for readability on a dark background. */
/** Changes the text colour for readability on a dark background. */
inverseColor?: boolean
/** Whether the list items show a marker. */
markers?: boolean
/** The text size for the unordered list. */
/** The size of the text. */
size?: 'small'
} & PropsWithChildren<HTMLAttributes<HTMLUListElement>>

Expand Down
2 changes: 1 addition & 1 deletion storybook/src/components/Blockquote/Blockquote.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const meta = {
},
argTypes: {
children: {
description: 'The text of the quote.',
description: 'The text for the quote.',
table: { disable: false },
},
},
Expand Down

0 comments on commit da99c5f

Please sign in to comment.