/*
 * SPDX-FileCopyrightText: 2023 Kristóf Marussy
 *
 * SPDX-License-Identifier: MIT
 */

import type { ReactNode } from 'react';

import styles from './Subtitle.module.css';

export default function Subtitle({
  icon,
  children,
}: {
  icon?: string;
  children?: ReactNode;
}) {
  return (
    <h3 className={styles.subtitle}>
      {icon !== undefined && <span aria-hidden="true">{icon}&nbsp;</span>}
      {children}
    </h3>
  );
}

Subtitle.defaultProps = {
  icon: undefined,
  children: undefined,
};
