---
import Hr from "./Hr.astro";
import Socials from "./Socials.astro";

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

export interface Props {
  noMarginTop?: boolean;
}

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

<footer class={`${noMarginTop ? "" : "mt-auto"}`}>
  <Hr noPadding />
  <div class="footer-wrapper">
    <Socials centered />
    <div class="copyright-wrapper">
      <span>Copyright &#169; {currentYear}</span>
      <span class="separator">&nbsp;|&nbsp;</span>
      <span>All rights reserved.</span>
    </div>
  </div>
</footer>

<style>
  footer {
    @apply w-full;
  }
  .footer-wrapper {
    @apply flex flex-col items-center justify-between py-6 sm:flex-row-reverse sm:py-4;
  }
  .link-button {
    @apply my-1 p-2 hover:rotate-6;
  }
  .link-button svg {
    @apply scale-125;
  }
  .copyright-wrapper {
    @apply my-2 flex flex-col items-center whitespace-nowrap sm:flex-row;
  }
  .separator {
    @apply hidden sm:inline;
  }
</style>
