TopBanner.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. <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>
  13. <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>
  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. font-family: Oswald;
  59. }
  60. .cubetti_bg {
  61. position: absolute;
  62. background: white;
  63. height: calc(150px * 0.666);
  64. width: calc(140px * 0.55);
  65. top: -8px;
  66. left: 8px;
  67. border-radius: 6px;
  68. &:before {
  69. content: "";
  70. background: linear-gradient(0deg, var(--color-sky-900), transparent);
  71. opacity: 0.25;
  72. position: absolute;
  73. height: 100%;
  74. width: 100%;
  75. z-index: -1;
  76. filter: blur(10px);
  77. }
  78. @media screen and (width >= theme(breakpoint.sm)) {
  79. position: absolute;
  80. background: white;
  81. height: 150px;
  82. width: 140px;
  83. top: -10px;
  84. left: 45px;
  85. border-radius: 12px;
  86. &:before {
  87. content: "";
  88. background: linear-gradient(0deg, var(--color-sky-900), transparent);
  89. opacity: 0.25;
  90. position: absolute;
  91. height: 100%;
  92. width: 100%;
  93. z-index: -1;
  94. filter: blur(10px);
  95. }
  96. }
  97. }
  98. }
  99. }
  100. </style>
  101. <script lang="ts" setup>
  102. const pageClasses = useState<string[]>('pageClasses').value || [];
  103. const route = useRoute();
  104. const error = useError();
  105. const isIndexPage = computed(() => route.name === 'index' && error.value === undefined);
  106. </script>