Return device type with sass function

11 views Asked by At

I want to create a function that returns the device type based on media queries using scss.

For now I I've tried this:

@function getDevice() {
    @media screen and (width <= 800px) {
        @return mobile;
    }
    @media screen and (width > 800px) and (width <= 1024px) {
        @return tablet;
    }
    @media screen and (width > 1024px) {
        @return desktop;
    }
}

But that returns me an error on the @media saying } expectedscss(css-rcurlyexpected)

So if y'all have any idea on how to fix it or a different approach i'll take it :)

0

There are 0 answers