diff --git a/packages/edit-site/src/components/app/index.js b/packages/edit-site/src/components/app/index.js index cad76b3ea1fb83..37db1a5dc5604b 100644 --- a/packages/edit-site/src/components/app/index.js +++ b/packages/edit-site/src/components/app/index.js @@ -14,6 +14,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router'; */ import Layout from '../layout'; import { GlobalStylesProvider } from '../global-styles/global-styles-provider'; +import FontLibraryProvider from '../global-styles/font-library-provider'; import { unlock } from '../../lock-unlock'; const { RouterProvider } = unlock( routerPrivateApis ); @@ -37,10 +38,12 @@ export default function App() { - - - - + + + + + + ); diff --git a/packages/edit-site/src/components/global-styles/font-families.js b/packages/edit-site/src/components/global-styles/font-families.js index 7a7597878eacd1..45e73c0e7f2598 100644 --- a/packages/edit-site/src/components/global-styles/font-families.js +++ b/packages/edit-site/src/components/global-styles/font-families.js @@ -2,6 +2,7 @@ * WordPress dependencies */ import { __ } from '@wordpress/i18n'; +import { useDispatch } from '@wordpress/data'; import { __experimentalItemGroup as ItemGroup, __experimentalVStack as VStack, @@ -11,67 +12,47 @@ import { } from '@wordpress/components'; import { typography } from '@wordpress/icons'; import { useContext } from '@wordpress/element'; +import { store as interfaceStore } from '@wordpress/interface'; /** * Internal dependencies */ -import FontLibraryProvider, { - FontLibraryContext, -} from './font-library-modal/context'; -import FontLibraryModal from './font-library-modal'; +import { FontLibraryContext } from './font-library-provider'; import FontFamilyItem from './font-family-item'; import Subtitle from './subtitle'; +import { FONT_LIBRARY_MODAL_NAME } from './font-library-modal'; -function FontFamilies() { - const { modalTabOpen, toggleModal, themeFonts, customFonts } = - useContext( FontLibraryContext ); - +export default function FontFamilies() { + const { themeFonts, customFonts } = useContext( FontLibraryContext ); + const { openModal } = useDispatch( interfaceStore ); const hasFonts = 0 < customFonts.length || 0 < themeFonts.length; return ( - <> - { !! modalTabOpen && ( - toggleModal() } - initialTabName={ modalTabOpen } - /> - ) } - - - - { __( 'Fonts' ) } - - -