Add toggle logic to the sidebar navigation.