TopBanner.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <header :class="`top_banner print:hidden page ${pageClasses.join(' ')}`">
  3. <div class="container mx-auto max-w-screen-xl z-10">
  4. <a href="/">
  5. <ClientOnly>
  6. <span class="sr-only">Home page</span>
  7. <div class="cubetti_bg" />
  8. <Cubetti />
  9. </ClientOnly>
  10. </a>
  11. <div v-if="!isIndexPage">
  12. <a href="#main" class="skip sr-only">Skip to main content</a>
  13. <div class="headline sm:ml-52 ml-24 pt-2 sm:pt-4"><span class="sm:text-4xl text-3xl text-white"><slot name="headline">Default Headline from TopBanner</slot></span></div>
  14. <div class="subheadline sm:ml-56 ml-28"><span class="sm:text-2xl text-xl text-white"><slot name="tagline">Default tagline from TopBanner</slot></span></div>
  15. </div>
  16. <div v-if="isIndexPage" class="ml-2">
  17. <div class="headline sm:-ml-48 -ml-36 pt-3 sm:pt-4 text-center"><h1 class="sm:text-3xl text-2xl text-white">Hello</h1></div>
  18. <div class="subheadline ml-14 -mt-8 text-center"><h2 class="sm:text-5xl text-4xl text-white">I'm Andrea</h2></div>
  19. <a href="#main" class="skip sr-only">Skip to main content</a>
  20. </div>
  21. </div>
  22. </header>
  23. </template>
  24. <style lang="pcss">
  25. @reference '../assets/css/main.css';
  26. html.no-webp {
  27. body {
  28. &.research .top_banner {
  29. background-image: url("/images/banner_research-2x.jpg");
  30. }
  31. &.writing .top_banner {
  32. background-image: url("/images/banner_writing-2x.jpg");
  33. }
  34. .top_banner {
  35. background-image: url("/images/banner.jpg");
  36. }
  37. }
  38. }
  39. body {
  40. &.research .top_banner {
  41. background-image: url("/images/banner_research-2x.webp");
  42. }
  43. &.writing .top_banner {
  44. background-image: url("/images/banner_writing-2x.webp");
  45. background-position: 0 100%;
  46. }
  47. }
  48. .top_banner {
  49. background-image: url("/images/banner.webp");
  50. background-position: center;
  51. background-size: cover;
  52. height: 80px;
  53. @variant sm {
  54. height: 100px;
  55. }
  56. .container {
  57. position: relative;
  58. .headline, .subheadline {
  59. text-shadow: 0px 0px 8px var(--color-sky-900);
  60. font-family: Oswald;
  61. }
  62. .cubetti_bg {
  63. position: absolute;
  64. background: white;
  65. height: calc(150px * 0.666);
  66. width: calc(140px * 0.55);
  67. top: -8px;
  68. left: 8px;
  69. border-radius: 6px;
  70. &:before {
  71. content: "";
  72. background: linear-gradient(0deg, var(--color-sky-900), transparent);
  73. opacity: 0.25;
  74. position: absolute;
  75. height: 100%;
  76. width: 100%;
  77. z-index: -1;
  78. filter: blur(10px);
  79. }
  80. @media screen and (width >= theme(breakpoint.sm)) {
  81. position: absolute;
  82. background: white;
  83. height: 150px;
  84. width: 140px;
  85. top: -10px;
  86. left: 45px;
  87. border-radius: 12px;
  88. &:before {
  89. content: "";
  90. background: linear-gradient(0deg, var(--color-sky-900), transparent);
  91. opacity: 0.25;
  92. position: absolute;
  93. height: 100%;
  94. width: 100%;
  95. z-index: -1;
  96. filter: blur(10px);
  97. }
  98. }
  99. }
  100. }
  101. }
  102. </style>
  103. <script lang="ts" setup>
  104. const pageClasses = useState<string[]>('pageClasses').value || [];
  105. const route = useRoute();
  106. const error = useError();
  107. const isIndexPage = computed(() => route.name === 'index' && error.value === undefined);
  108. </script>