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

Add Customizable Persistent Screen Sizes for Slice Simulator in slicemachine.config.json #1534

Closed
yacb2 opened this issue Jan 19, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@yacb2
Copy link

yacb2 commented Jan 19, 2025

When testing slices and their variants in the Slice Machine simulator, it can be inconvenient to manually adjust pixel values for custom resolutions repeatedly. While the simulator currently supports breakpoints such as Desktop, Tablet, Mobile, and Custom, there is no way to predefine pixel values or add additional breakpoints that persist across the project. This makes testing multiple screen sizes more time-consuming.

It would be helpful to allow users to define custom screen sizes for the simulator that are persistent within a project. A viable option could be to configure these custom screen sizes directly in the slicemachine.config.json file. For example:

{
  "repositoryName": "repositoryName",
  "adapter": "@slicemachine/adapter-sveltekit",
  "libraries": [
    "./src/lib/slices"
  ],
  "localSliceSimulatorURL": "http://localhost:5199/slice-simulator",
  "simulatorScreens": [
    { "name": "Desktop 2XL", "value": 1536 },
    { "name": "Desktop XL", "value": 1280 },
    { "name": "Desktop LG", "value": 1024 },
    { "name": "Tablet", "value": 768 },
    { "name": "Mobile", "value": 480 }
  ]
}

This configuration would allow developers to define custom screen sizes that appear as options in the simulator, improving testing efficiency and ensuring consistency across the project.

Describe alternatives you've considered

Currently, the only way to test different screen sizes is by manually adjusting the pixel value in the “Custom” option for each session. While functional, this method is not ideal for projects that need consistent testing across multiple breakpoints.

This feature would be particularly useful for teams working with responsive designs, as it would streamline testing for various screen sizes and ensure uniformity. Here’s an example of how the custom screen sizes could appear in the simulator dropdown:
• Desktop 2XL (1536px)
• Desktop XL (1280px)
• Desktop LG (1024px)
• Tablet (768px)
• Mobile (480px)

Thank you so much for considering this suggestion! It would greatly enhance the developer experience and make responsive design testing much smoother. 💙

@yacb2 yacb2 added the enhancement New feature or request label Jan 19, 2025
@benjammartin
Copy link
Contributor

Hey @yacb2,

Thanks for your detailed suggestion!

For now, we haven’t defined a clear direction for the simulator’s evolution, and we’ve decided not to make any changes to it at this time. That being said, we appreciate the feedback and will keep this in mind for future iterations.

Thanks again for taking the time to share your thoughts! 💙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants