Skip to content

Instantly share code, notes, and snippets.

@thomasin
thomasin / tailwind-elmbook-screens.js
Last active June 13, 2022 10:37
Adjust Tailwind breakpoints to account for elm-book full width components being smaller than viewport width
function screens() {
const xs = '420px'
// This adjusts the breakpoints so that a full width book component still
// looks correct even with the extra sidebar/spacing that elm-book adds.
if (process.env.BOOK) {
console.log("Generating breakpoints for book site")
// Sidebar width, body margins, component padding, component border, right body padding
const after768 = 300 + 40 + 40 + 12 + 12 + 1 + 1 + 8
// Body padding, body margins, component padding, component border

Keybase proof

I hereby claim:

  • I am thomasin on github.
  • I am thomasin (https://keybase.io/thomasin) on keybase.
  • I have a public key ASBsZOd_5D1_jOOu8bjDnL79Edao2NuUHvQ2_QObThn7mwo

To claim this, I am signing this object: