TopBanner.vue 3.6 KB

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