From 48a0b6fa4396d9c5d4058b2f33df76171ab9c711 Mon Sep 17 00:00:00 2001 From: tripathyr Date: Thu, 19 Oct 2023 07:03:51 +0530 Subject: [PATCH] Create UI.md --- docs/UI.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 docs/UI.md diff --git a/docs/UI.md b/docs/UI.md new file mode 100644 index 0000000..9204653 --- /dev/null +++ b/docs/UI.md @@ -0,0 +1,18 @@ +## routeTo(targetPage, options = {}) explanation +- routeTo handles routing and animation logic for our web applications. This function takes a targetPage and an optional options object as parameters. +- Destructures options Object: firstLoad, hashChange, and isPreview are destructured from the options object. +- Parsing targetPage: + 1. If targetPage is an empty string, pageId is set to 'check_details'. + 2. If targetPage contains a slash (/), it splits targetPage into parts. The first part is the pageId, and the second part (if any) is further split into subPageId1. +Query parameters are parsed from the search parameters of the URL, if available. +- Handling check_details Page: + 1. If the pageId is 'check_details', it checks for query parameters. If there are query parameters, it updates the search input value and renders query results. +- Animating Navigation: + 1. Animates the transition of the navigation menu based on the current and previous active elements. + 2. Handles the indicator animation to show the active menu item. + 3. If the current page is not found in the navigation menu, it hides the navigation bar. +- Showing/Hiding Pages: + 1. Hides all pages, then shows the target page and animates its opacity to make it visible. +- Updating pagesData.lastPage: + 1. Updates the lastPage property of pagesData to keep track of the last visited page. +