Skip to content

Commit

Permalink
feat(ui): keep sidebar collapsed state on localStorage
Browse files Browse the repository at this point in the history
close #773
  • Loading branch information
tchiotludo committed Oct 24, 2021
1 parent 01870d3 commit 675a6bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/components/Base/Base.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Base extends Component {
selectedTab: constants.CLUSTER, //cluster | node | topic | tail | group | acls | schema | connect
action: '',
loading: false,
expanded: false
expanded: !!localStorage.getItem('expanded')
};

static getDerivedStateFromProps(nextProps) {
Expand Down Expand Up @@ -74,6 +74,7 @@ class Base extends Component {
clusters={clusters}
expanded={expanded}
toggleSidebar={newExpanded => {
newExpanded ? localStorage.setItem('expanded', newExpanded) : localStorage.removeItem('expanded');
this.setState({ expanded: newExpanded });
}}
selectedTab={selectedTab}
Expand Down

0 comments on commit 675a6bf

Please sign in to comment.