Last active
February 1, 2024 01:22
-
-
Save jose-mdz/0f4708f094e70009367529e1b9eb6a4e to your computer and use it in GitHub Desktop.
Use Tailwind Screen config in code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import resolveConfig from "tailwindcss/resolveConfig"; | |
import tailwindConfig from "../../tailwind.config"; | |
function Component() { | |
const fullConfig = resolveConfig(tailwindConfig); | |
const [horizontal, setHorizontal] = useState<boolean>( | |
screen && screen.availWidth >= parseInt(fullConfig.theme.screens.sm), | |
); | |
// Do something with decision | |
return <div/> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment