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

Decorate components with jsdoc #182

Open
seanes opened this issue Jan 21, 2025 · 0 comments
Open

Decorate components with jsdoc #182

seanes opened this issue Jan 21, 2025 · 0 comments
Labels
kind/documentation Improvements or additions to documentation

Comments

@seanes
Copy link
Collaborator

seanes commented Jan 21, 2025

In order to improve developer experience and increase understanding of the usage of the components, we should decorate our components with (jsdoc)[https://jsdoc.app/].

Today Storybook already creates documentation of the comments for each prop, so jsdoc of components should not be in favor of this.
Could we find a clever way of producing jsdoc automatically by converting these comments, e.g. with better-docs?


 /**
 * Props for the Avatar component.*/
export interface AvatarProps {
  /** The name to display in the avatar. */
  name: string;
  /** The type of avatar. */
  type?: AvatarType;
  /** The size of the avatar. */
  size?: AvatarSize;
  /** Additional class names to apply to the avatar. */
  className?: string;
  /** URL of the image to display in the avatar. */
  imageUrl?: string;
  /** Alt text for the image. */
  imageUrlAlt?: string;
  /** Whether to display an outline around the avatar. */
  outline?: boolean;
  /** Custom label to display inside the avatar. */
  customLabel?: string;
}

/**
 * Avatar component to display user or company avatars with various customization options.
 */
export const Avatar = ({

could output

 * Avatar component to display user or company avatars with various customization options.
 *
 * @component
 * @param {Object} props - The properties for the Avatar component.
 * @param {string} props.name - The name to display in the avatar.
 * @param {'company' | 'person' | 'custom'} [props.type='person'] - The type of avatar.
 * @param {'xs' | 'sm' | 'md' | 'lg' | 'xl'} [props.size='sm'] - The size of the avatar.
 * @param {string} [props.className] - Additional class names to apply to the avatar.
 * @param {string} [props.imageUrl] - URL of the image to display in the avatar.
 * @param {string} [props.imageUrlAlt] - Alt text for the image.
 * @param {boolean} [props.outline=false] - Whether to display an outline around the avatar.
 * @param {string} [props.customLabel] - Custom label to display inside the avatar.
 * @returns {JSX.Element} The Avatar component.
 */

(this jsdoc was generated by kindly asking co-pilot)

@seanes seanes added the kind/documentation Improvements or additions to documentation label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant