SRGSSR / pillarbox-web

Pillarbox is a versatile media playback ecosystem engineered for the web.
https://srgssr.github.io/pillarbox-web-demo/
MIT License
12 stars 1 forks source link

feat(demo): add search page #78

Closed jboix closed 10 months ago

jboix commented 10 months ago

Description

Closes #65

This commit introduces a significant feature to the demo, transforming it into a Single Page Application (SPA) by incorporating a router. This enhancement provides a seamless navigation experience within the application. The primary focus of this feature is the addition of a search page, accessible through the introduced router.

Search Page

The search page is designed to facilitate efficient content discovery within the application. It consists of two key components:

  1. Dropdown: Allows users to choose from RSI, RTR, RTS, SRF, or SWI.

  2. Search Bar: Enables users to perform free-text searches.

Changes made

The project structure has been reorganized to enhance modularity and maintainability. The following folders have been added:

Router Integration

To utilize the introduced router, follow these steps:

  1. Import the Router:

    import router from './path/to/Router';
  2. Define Routes: Use the addRoute method to define routes and associated functions.

    router.addRoute('/', () => {
     // Function to execute when navigating to the root path
     console.log('Navigated to the root path');
    }, () => {
     // Function to execute when navigating away from the root path
     console.log('Navigated away from the root path');
    });
  3. Integrate with <a> Tags: Add the data-spa-route attribute to <a> tags for seamless navigation.

    <a href="/" data-spa-route>Home</a>
    <a href="/about" data-spa-route>About</a>
github-actions[bot] commented 10 months ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟢 Statements 98.36% 481/489
🟢 Branches 93.42% 227/243
🟢 Functions 100% 137/137
🟢 Lines 99.15% 464/468

Test suite run success

142 tests passing in 9 suites.

Report generated by 🧪jest coverage report action from 845a1d0da601075bac88fb141358d874e9a4a8bf

amtins commented 10 months ago

@jboix LGTM! perfection