---
import Hr from "./Hr.astro";
import "../config";
import { SITE } from "../config";

const currentYear = new Date().getFullYear();

export interface Props {
  noMarginTop?: boolean;
}

const { noMarginTop = false } = Astro.props;
---

<footer class:list={["w-full", { "mt-auto": !noMarginTop }]}>
  <Hr noPadding />
  <div class="flex flex-col items-center py-4 sm:py-3">
    <div class="flex flex-col sm:flex-row items-center gap-2 mb-2">
      {SITE.gabeian.enabled && (
        <div class="flex items-center gap-1">
          <img src="/assets/gabeian.png" alt="Gabeian" class="h-4 w-4" />
          <a
            href="https://beian.mps.gov.cn/#/query/webSearch?code=41168102000247"
            rel="noreferrer"
            target="_blank"
            class="underline hover:text-accent hover:no-underline"
          >
            {SITE.gabeian.id}
          </a>
        </div>
      )}
      {SITE.beian.enabled && (
        <a
          href="https://beian.miit.gov.cn/"
          target="_blank"
          class="underline hover:text-accent hover:no-underline"
        >
          {SITE.beian.id}
        </a>
      )}
    </div>
    <div class="flex flex-col sm:flex-row items-center whitespace-nowrap">
      <span>版权所有 &#169; {SITE.created}-{currentYear}&nbsp;{SITE.author}</span>
      <span class="sm:ml-2">保留所有权利</span>
    </div>
  </div>
</footer>
