TopBanner.vue 3.9 KB

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