From 675a6bf056f2215cd6763e82a42bd89e8be24607 Mon Sep 17 00:00:00 2001 From: tchiotludo Date: Sun, 1 Aug 2021 21:01:33 +0200 Subject: [PATCH] feat(ui): keep sidebar collapsed state on localStorage close #773 --- client/src/components/Base/Base.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/components/Base/Base.jsx b/client/src/components/Base/Base.jsx index 525c04dd5..40d488ba4 100644 --- a/client/src/components/Base/Base.jsx +++ b/client/src/components/Base/Base.jsx @@ -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) { @@ -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}