Minimal implementation of responsive sidebars
This project is somewhat of a research experiment
into the most convenient way of implementing responsive sidebars.
width: 0
when closed)The code is deliberately kept minimal to not distract from the
sidebar mechanics.
The main version uses flexbox, but there are other branches
exploring CSS grid and absolute positioning.
3 flex items are used for their adaptive features:
the sidebars #left
and #right
, and the main content #main
.
This allows pushing the main content aside when the landscape sidebars open
(by transitioning the #left
and #right
widths).
However, since we want the sidebars to be fixed-width, so they do not
rearrange their content while opening, the actual sidebars are not these
variable-width flex items, but child divs with fixed widths.
As a result, the sidebars make use of 2 separate transitions:
#left
and #right
flex items’ width from 0 to thetransform: translateX(-100%)
property.For a more mature implementation, see gatsby-theme-simpwa
and its starter gatsby-starter-simpwa.
You can see them both deployed here.