Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore tweak dynamicdatabanner UI #980

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

adriangohjw
Copy link
Contributor

@adriangohjw adriangohjw commented Jan 9, 2025

Problem

New UI requirement to reduce screen estate on desktop and mobile

Solution

Breaking Changes

  • Yes - this PR contains breaking changes
    • Details ...
  • No - this PR is backwards compatible

Improvements:

  • replace storybook-addon-mock with msw and msw-storybook-addon (consistent with Studio)
  • update UI based on new requirements in Figma
  • add loading state
  • shifted the position in homepage stories to above the hero since that's the real world use case

Before & After Screenshots

(refer to storybook)

Tests

  1. add the dynamic data banner component via raw json mode (since its not supported in studio)
{
      "type": "dynamicdatabanner",
      "apiEndpoint": "https://isomer-user-content.by.gov.sg/muis_prayers_timetable_2025.json",
      "title": "hijri_date",
      "data": [
        {
          "label": "Subuh",
          "key": "subuh"
        },
        {
          "label": "Syuruk",
          "key": "syuruk"
        },
        {
          "label": "Zohor",
          "key": "zohor"
        },
        {
          "label": "Asar",
          "key": "asar"
        },
        {
          "label": "Maghrib",
          "key": "maghrib"
        },
        {
          "label": "Ishak",
          "key": "isyak"
        }
      ],
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
      "label": "View all dates",
      "errorMessage": [
        {
          "text": "Couldn’t load prayer times. Try refreshing the page.",
          "type": "text",
        },
      ],
    },   
  1. ensure its rendered to the new UI in Figma
    a. success state (based on the above)
    b. error state - replace URL inapiEndpoint to a random value
    c. loading state - (slightly harder to test since we are fetching it from CF with the same latency but you can try using dev console to throttle network)

New dev dependencies:

  • dependency : msw and msw-storybook-addon

@adriangohjw adriangohjw added enhancement New feature or request dependencies Pull requests that update a dependency file labels Jan 9, 2025
@adriangohjw adriangohjw self-assigned this Jan 9, 2025
@adriangohjw adriangohjw requested a review from a team as a code owner January 9, 2025 21:08
@datadog-opengovsg
Copy link

datadog-opengovsg bot commented Jan 9, 2025

Datadog Report

Branch report: chore-tweak-dynamicdatabanner-ui
Commit report: 9d309da
Test service: isomer-studio

✅ 0 Failed, 257 Passed, 36 Skipped, 50.9s Total Time
🔻 Test Sessions change in coverage: 1 decreased (-0.27%)

🔻 Code Coverage Decreases vs Default Branch (1)

  • vitest run --coverage 6.1% (-0.27%) - Details

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autogenerated from msw setup instructions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant