Header.astro 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ---
  2. import config from 'virtual:starlight/user-config';
  3. import { Icon } from '@astrojs/starlight/components';
  4. import { HeaderLinks } from 'toolbeam-docs-theme/components';
  5. import Default from 'toolbeam-docs-theme/overrides/Header.astro';
  6. import SiteTitle from '@astrojs/starlight/components/SiteTitle.astro';
  7. const path = Astro.url.pathname;
  8. const links = config.social || [];
  9. ---
  10. { path.startsWith("/share")
  11. ? <div class="header sl-flex">
  12. <div class="title-wrapper sl-flex">
  13. <SiteTitle {...Astro.props} />
  14. </div>
  15. <div class="middle-group sl-flex">
  16. <HeaderLinks {...Astro.props} />
  17. </div>
  18. </div>
  19. : <Default {...Astro.props}><slot /></Default>
  20. }
  21. <style>
  22. .header {
  23. justify-content: space-between;
  24. align-items: center;
  25. height: 100%;
  26. }
  27. .title-wrapper {
  28. /* Prevent long titles overflowing and covering the search and menu buttons on narrow viewports. */
  29. overflow: clip;
  30. /* Avoid clipping focus ring around link inside title wrapper. */
  31. padding: calc(0.25rem + 2px) 0.25rem calc(0.25rem - 2px);
  32. margin: -0.25rem;
  33. }
  34. .middle-group {
  35. justify-content: flex-end;
  36. gap: var(--sl-nav-gap);
  37. }
  38. @media (max-width: 50rem) {
  39. :global(:root[data-has-sidebar]) {
  40. .middle-group {
  41. display: none;
  42. }
  43. }
  44. }
  45. @media (min-width: 50rem) {
  46. .middle-group {
  47. display: flex;
  48. }
  49. }
  50. </style>