+page.svelte 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <script>
  2. let searchInput;
  3. $effect(()=>{
  4. searchInput?.focus();
  5. });
  6. </script>
  7. <form>
  8. <input type="text" placeholder="Search Recipes" bind:this={searchInput} required>
  9. <button type="submit" aria-label="Search recipes">
  10. <svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" color="#000000" aria-hidden="true">
  11. <path d="M17 17L21 21" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
  12. <path d="M3 11C3 15.4183 6.58172 19 11 19C13.213 19 15.2161 18.1015 16.6644 16.6493C18.1077 15.2022 19 13.2053 19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11Z" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
  13. </svg>
  14. </button>
  15. </form>
  16. <style>
  17. form{
  18. display: flex;
  19. align-items: center;
  20. justify-content: center;
  21. gap: 0.5rem;
  22. width: min(480px, 90vw);
  23. margin: 40vh auto 0;
  24. padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  25. background: #ffffff;
  26. border-radius: 999px;
  27. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  28. }
  29. input[type="text"]{
  30. flex: 1;
  31. border: none;
  32. outline: none;
  33. background: none;
  34. font-size: 1rem;
  35. color: #000000;
  36. }
  37. button{
  38. display: flex;
  39. align-items: center;
  40. justify-content: center;
  41. width: 2.5rem;
  42. height: 2.5rem;
  43. background: #000000;
  44. border: none;
  45. border-radius: 50%;
  46. cursor: pointer;
  47. flex-shrink: 0;
  48. transition: background 0.15s ease, transform 0.1s ease;
  49. }
  50. button:hover{
  51. background: #333333;
  52. }
  53. button:active{
  54. background: #555555;
  55. transform: scale(0.92);
  56. }
  57. </style>