-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Global Styles: Add Welcome Guide toggle (#37180)
* Global Styles: Add Welcome Guide toggle * Check isActive state locally in components
- Loading branch information
1 parent
8f7e53e
commit ad9c5d9
Showing
5 changed files
with
45 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,14 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useSelect } from '@wordpress/data'; | ||
import { store as interfaceStore } from '@wordpress/interface'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import WelcomeGuideEditor from './editor'; | ||
import WelcomeGuideStyles from './styles'; | ||
import { store as editSiteStore } from '../../store'; | ||
|
||
export default function WelcomeGuide() { | ||
const { isActive, isStylesOpen } = useSelect( ( select ) => { | ||
const sidebar = select( interfaceStore ).getActiveComplementaryArea( | ||
editSiteStore.name | ||
); | ||
const isStylesSidebar = sidebar === 'edit-site/global-styles'; | ||
const feature = isStylesSidebar ? 'welcomeGuideStyles' : 'welcomeGuide'; | ||
|
||
return { | ||
isActive: select( editSiteStore ).isFeatureActive( feature ), | ||
isStylesOpen: isStylesSidebar, | ||
}; | ||
}, [] ); | ||
|
||
if ( ! isActive ) { | ||
return null; | ||
} | ||
|
||
return isStylesOpen ? <WelcomeGuideStyles /> : <WelcomeGuideEditor />; | ||
return ( | ||
<> | ||
<WelcomeGuideEditor /> | ||
<WelcomeGuideStyles /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters