TopBanner.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <div :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"><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. </div>
  21. </template>
  22. <style lang="pcss">
  23. html.no-webp {
  24. body {
  25. &.research .top_banner {
  26. background-image: url("/images/banner_research-2x.jpg");
  27. }
  28. &.writing .top_banner {
  29. background-image: url("/images/banner_writing-2x.jpg");
  30. }
  31. .top_banner {
  32. background-image: url("/images/banner.jpg");
  33. }
  34. }
  35. }
  36. body {
  37. &.research .top_banner {
  38. background-image: url("/images/banner_research-2x.webp");
  39. }
  40. &.writing .top_banner {
  41. background-image: url("/images/banner_writing-2x.webp");
  42. background-position: 0 100%;
  43. }
  44. }
  45. .top_banner {
  46. background-image: url("/images/banner.webp");
  47. background-position: center;
  48. background-size: cover;
  49. height: 80px;
  50. @media screen(sm) {
  51. height: 100px;
  52. }
  53. .container {
  54. position: relative;
  55. .headline, .subheadline {
  56. text-shadow: 0px 0px 4px theme(colors.sky.900);
  57. }
  58. .cubetti_bg {
  59. position: absolute;
  60. background: white;
  61. height: calc(150px * 0.58);
  62. width: calc(140px * 0.55);
  63. top: 8px;
  64. left: 8px;
  65. border-radius: 6px;
  66. &:before {
  67. content: "";
  68. background: linear-gradient(0deg, theme(colors.sky.900), transparent);
  69. opacity: 0.25;
  70. position: absolute;
  71. height: 100%;
  72. width: 100%;
  73. z-index: -1;
  74. filter: blur(10px);
  75. }
  76. @media screen(sm) {
  77. position: absolute;
  78. background: white;
  79. height: 150px;
  80. width: 140px;
  81. top: -10px;
  82. left: 45px;
  83. border-radius: 12px;
  84. &:before {
  85. content: "";
  86. background: linear-gradient(0deg, theme(colors.sky.900), transparent);
  87. opacity: 0.25;
  88. position: absolute;
  89. height: 100%;
  90. width: 100%;
  91. z-index: -1;
  92. filter: blur(10px);
  93. }
  94. }
  95. }
  96. }
  97. }
  98. </style>
  99. <script lang="ts" setup>
  100. const pageClasses = useState<string[]>('pageClasses').value || [];
  101. const route = useRoute();
  102. const error = useError();
  103. const isIndexPage = computed(() => route.name === 'index' && error.value === undefined);
  104. </script>