From 0d17432d0e624d2dba9b42e012c123370cd5a04d Mon Sep 17 00:00:00 2001 From: Sonika Date: Mon, 19 Feb 2024 08:43:20 +0530 Subject: [PATCH] cleanup --- src/APIopertaions.svelte | 13 +++++-------- src/App.svelte | 24 ++++++++++++------------ src/CRUDoperations.svelte | 22 ++++++++-------------- 3 files changed, 25 insertions(+), 34 deletions(-) diff --git a/src/APIopertaions.svelte b/src/APIopertaions.svelte index 784a487..998a8e5 100644 --- a/src/APIopertaions.svelte +++ b/src/APIopertaions.svelte @@ -1,32 +1,29 @@

hi

- - - +
    {#each fetchedData as item}
  • {item.first} {item.last}
  • diff --git a/src/App.svelte b/src/App.svelte index b5997e2..31a830e 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -3,23 +3,23 @@ import ApIopertaions from "./APIopertaions.svelte"; import CRUDoperations from "./CRUDoperations.svelte"; - // Define a variable to track the current route + let currentRoute = ''; - // Function to update the current route based on the URL hash + function updateRouteFromHash() { - currentRoute = window.location.hash.slice(1); // Remove '#' from the URL hash + currentRoute = window.location.hash.slice(1); } - // Call the updateRouteFromHash function when the component is mounted + onMount(() => { - window.addEventListener('hashchange', updateRouteFromHash); // Listen for hash change events - updateRouteFromHash(); // Update the current route initially + window.addEventListener('hashchange', updateRouteFromHash); + updateRouteFromHash(); }); - // Function to navigate to a different route + function navigateTo(route) { - window.location.hash = route; // Update the URL hash + window.location.hash = route; } @@ -57,23 +57,23 @@
    -

    POC

    +

    Svelte

    - + {#if currentRoute === 'api'} {:else if currentRoute === 'crud'} {:else} - +

    Page not found

    {/if} \ No newline at end of file diff --git a/src/CRUDoperations.svelte b/src/CRUDoperations.svelte index 654bdc6..3c0d9f4 100644 --- a/src/CRUDoperations.svelte +++ b/src/CRUDoperations.svelte @@ -82,37 +82,31 @@ } .container { - width: 500px; /* Increase width for a bigger dialog box */ - padding: 40px; /* Increase padding for more spacing inside the dialog box */ - background-color: #ffffff; /* Change background color to white */ + width: 500px; + padding: 40px; + background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); } label { display: block; - margin-bottom: 16px; /* Increase margin bottom for more spacing between elements */ + margin-bottom: 16px; color: #333; } - input[type="text"], + select { width: 100%; - padding: 12px; /* Increase padding for larger input fields */ + padding: 12px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; - margin-bottom: 24px; /* Increase margin bottom for more spacing between elements */ - font-size: 16px; - } - - .button-group { - display: flex; - justify-content: space-between; + margin-bottom: 24px; } button { - padding: 12px 24px; /* Increase padding for larger buttons */ + padding: 12px 24px; border: none; border-radius: 4px; cursor: pointer;