Skip to content

Commit

Permalink
docs: improve typography components documentations
Browse files Browse the repository at this point in the history
  • Loading branch information
jtiala committed Jan 25, 2024
1 parent 5f0dbf3 commit 17b2cde
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/react/src/components/Blockquote/Blockquote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const authorClassName = cn("blockquote-author");
const sourceClassName = cn("blockquote-source");

/**
* Display an extended quotation.
* A visual element for displaying blockquotes or cited sections of text.
*/
export function Blockquote({
cite,
Expand Down
6 changes: 2 additions & 4 deletions packages/react/src/components/Heading/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ export type HeadingProps = {
const className = cn("heading");

/**
* Display a section heading.
* A heading.
*/
export function Heading({ level, children, id, testId }: HeadingProps) {
const element = "h" + level;

return createElement(
element,
`h${level}`,
{ className, id, "data-testid": testId },
children,
);
Expand Down
13 changes: 5 additions & 8 deletions packages/react/src/components/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,24 @@ type ListItemElement = ReactElement<ListItemProps, typeof ListItem>;
export type ListProps = {
/**
* Type of the list.
*
* @default unordered
*/
type?: ListType;

/**
* One or more <List.Item> elements.
* One or more `<List.Item>` elements.
*/
children?: ListItemElement | ListItemElement[] | ReactNode; // ReactNode is needed for MDXComponents
} & CommonComponentProps;

const className = cn("list");

/**
* Display a list of items.
* A list of items.
*/
export function List({ type, children, id, testId }: ListProps) {
const element = type === "ordered" ? "ol" : "ul";

export function List({ type = "unordered", children, id, testId }: ListProps) {
return createElement(
element,
type === "ordered" ? "ol" : "ul",

{ className, id, "data-testid": testId },
children,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/List/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type ListItemProps = {
} & CommonComponentProps;

/**
* Display a list item.
* A list item.
*/
export function ListItem({ children, id, testId }: ListItemProps) {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Paragraph/Paragraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type ParagraphProps = {
const className = cn("paragraph");

/**
* Display a text paragraph.
* A paragraph of text.
*/
export function Paragraph({ children, id, testId }: ParagraphProps) {
return (
Expand Down

0 comments on commit 17b2cde

Please sign in to comment.