Advertisement
Guest User

NavBar.svelte

a guest
Jun 27th, 2023
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.91 KB | None | 0 0
  1. <nav>
  2.   <svg viewBox="0 0 2 3" aria-hidden="true">
  3.     <path d="M0,0, L1, 2 C1.5, 3 1.5, 3, 2, 3, L2, 0Z" />
  4.   </svg>
  5.   <ul>
  6.     <li aria-current={$page.url.pathname === '/' ? 'page' : undefined}>
  7.     <a href="/">Home</a>
  8.     </li>
  9.     <li aria-current={$page.url.pathname === '/pool' ? 'page' : undefined}>
  10.     <a href="/pool">Pool Play</a>
  11.     </li>
  12.     <li aria-current={$page.url.pathname === '/bracket' ? 'page' : undefined}>
  13.     <a href="/bracket">Bracket Play</a>
  14.     </li>
  15.     <li aria-current={$page.url.pathname === '/admin' ? 'page' : undefined}>
  16.     <a href="/admin">Admin Stuff</a>
  17.     </li>
  18.   </ul>
  19.   <svg viewBox="0 0 2 3" aria-hidden="true">
  20.     <path d="M0,0 L0,3 C0.5,3 0.5,3 1,2 L2,0 Z" />
  21.   </svg>
  22. </nav>
  23.  
  24. <style>
  25.   nav {
  26.     display: flex;
  27.     justify-content: center;
  28.     --background: var(--color-theme-3);
  29.   }
  30.  
  31.   svg {
  32.     width: 2em;
  33.     height: 3em;
  34.     display: block;
  35.   }
  36.  
  37.   path {
  38.     fill: var(--color-theme-3);
  39.   }
  40.  
  41.   ul {
  42.     position: relative;
  43.     padding: 0;
  44.     margin: 0;
  45.     height: 3em;
  46.     display: flex;
  47.     justify-content: center;
  48.     align-items: center;
  49.     list-style: none;
  50.     background: var(--background);
  51.     background-size: contain;
  52.   }
  53.  
  54.   li {
  55.     position: relative;
  56.     height: 100%;
  57.   }
  58.  
  59.   li[aria-current='page']::before {
  60.     --size: 10px;
  61.     content: '';
  62.     width: 0;
  63.     height: 0;
  64.     position: absolute;
  65.     top: 0;
  66.     left: calc(50% - var(--size));
  67.     border: var(--size) solid transparent;
  68.     border-top: var(--size) solid var(--color-theme-1);
  69.   }
  70.  
  71.   nav a {
  72.     display: flex;
  73.     height: 100%;
  74.     align-items: center;
  75.     padding: 0 0.5rem;
  76.     color: var(--color-text);
  77.     font-weight: 700;
  78.     font-size: 0.8rem;
  79.     text-transform: uppercase;
  80.     letter-spacing: 0.1em;
  81.     text-decoration: none;
  82.     transition: color 0.2s linear;
  83.   }
  84.  
  85.   a:hover {
  86.     color: var(--color-theme-2);
  87.   }
  88. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement