github.com/kubri/kubri@v0.5.1-0.20240317001612-bda2aaef967e/website/src/plugins/changelog/theme/ChangelogItem/Header/Author/index.tsx (about)

     1  /**
     2   * Copyright (c) Facebook, Inc. and its affiliates.
     3   *
     4   * This source code is licensed under the MIT license found in the
     5   * LICENSE file in the root directory of this source tree.
     6   */
     7  
     8  import type { JSX } from 'react'
     9  import clsx from 'clsx'
    10  import Link from '@docusaurus/Link'
    11  import type { Props } from '@theme/BlogPostItem/Header/Author'
    12  
    13  import styles from './styles.module.css'
    14  
    15  export default function ChangelogAuthor({ author, className }: Props): JSX.Element {
    16    const { name, url, imageURL } = author
    17    return (
    18      <div className={clsx('avatar margin-bottom--sm', className)}>
    19        {imageURL && (
    20          <Link className="avatar__photo-link avatar__photo" href={url}>
    21            <img
    22              className={styles.image}
    23              src={imageURL}
    24              alt={name}
    25              onError={(e) => {
    26                // Image returns 404 if the user's handle changes. We display a
    27                // fallback instead.
    28                e.currentTarget.src =
    29                  'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600" fill="none" stroke="%2325c2a0" stroke-width="30" version="1.1"><circle cx="300" cy="230" r="115"/><path stroke-linecap="butt" d="M106.81863443903,481.4 a205,205 1 0,1 386.36273112194,0"/></svg>'
    30              }}
    31            />
    32          </Link>
    33        )}
    34      </div>
    35    )
    36  }