How to make different layouts for different screen sizes

I am having a hard time trying to figure this out. If the user is on a mobile app or on the mobile site, I would like to make a container card containing a list item the full width, but on a desktop I would like it to be a grid style, with each card only 25% wide, where the cards are repeated in new rows. Is there a way to do this in appgyver?

The only way to do that, is by using formula to define the container size. for example something like this
IF(systemVars.dimensions.viewport.width> 500, 25, 100)