diff --git a/packages/block-editor/src/hooks/typography.js b/packages/block-editor/src/hooks/typography.js
index 9b5d8fd28c9a3..c3959b8a1b3cd 100644
--- a/packages/block-editor/src/hooks/typography.js
+++ b/packages/block-editor/src/hooks/typography.js
@@ -231,7 +231,7 @@ export function TypographyPanel( props ) {
);
}
-const hasTypographySupport = ( blockName ) => {
+export const hasTypographySupport = ( blockName ) => {
return TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>
hasBlockSupport( blockName, key )
);
diff --git a/packages/edit-site/src/components/global-styles/screen-typography-element.js b/packages/edit-site/src/components/global-styles/screen-typography-element.js
new file mode 100644
index 0000000000000..706d361448ed5
--- /dev/null
+++ b/packages/edit-site/src/components/global-styles/screen-typography-element.js
@@ -0,0 +1,39 @@
+/**
+ * WordPress dependencies
+ */
+import { __ } from '@wordpress/i18n';
+
+/**
+ * Internal dependencies
+ */
+import TypographyPanel from './typography-panel';
+import ScreenHeader from './header';
+
+const elements = {
+ text: {
+ description: __( 'Manage the fonts used on the site.' ),
+ title: __( 'Text' ),
+ },
+ link: {
+ description: __( 'Manage the fonts and typography used on the links.' ),
+ title: __( 'Link' ),
+ },
+};
+
+function ScreenTypographyElement( { name, element } ) {
+ const parentMenu =
+ name === undefined ? '/typography' : '/blocks/' + name + '/typography';
+
+ return (
+ <>
+
+
+ >
+ );
+}
+
+export default ScreenTypographyElement;
diff --git a/packages/edit-site/src/components/global-styles/screen-typography.js b/packages/edit-site/src/components/global-styles/screen-typography.js
index 822eaa964f67d..e1d7520b4c201 100644
--- a/packages/edit-site/src/components/global-styles/screen-typography.js
+++ b/packages/edit-site/src/components/global-styles/screen-typography.js
@@ -2,12 +2,69 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
+import {
+ __experimentalItemGroup as ItemGroup,
+ __experimentalVStack as VStack,
+ __experimentalHStack as HStack,
+ FlexItem,
+} from '@wordpress/components';
/**
* Internal dependencies
*/
-import TypographyPanel from './typography-panel';
import ScreenHeader from './header';
+import NavigationButton from './navigation-button';
+import { useStyle } from './hooks';
+import Subtitle from './subtitle';
+import TypographyPanel from './typography-panel';
+
+function Item( { name, parentMenu, element, label } ) {
+ const hasSupport = ! name;
+ const prefix =
+ element === 'text' || ! element ? '' : `elements.${ element }.`;
+ const extraStyles =
+ element === 'link'
+ ? {
+ textDecoration: 'underline',
+ }
+ : {};
+ const [ fontFamily ] = useStyle( prefix + 'typography.fontFamily', name );
+ const [ fontStyle ] = useStyle( prefix + 'typography.fontStyle', name );
+ const [ fontWeight ] = useStyle( prefix + 'typography.fontWeight', name );
+ const [ letterSpacing ] = useStyle(
+ prefix + 'typography.letterSpacing',
+ name
+ );
+ const [ backgroundColor ] = useStyle( prefix + 'color.background', name );
+ const [ gradientValue ] = useStyle( prefix + 'color.gradient', name );
+ const [ color ] = useStyle( prefix + 'color.text', name );
+
+ if ( ! hasSupport ) {
+ return null;
+ }
+
+ return (
+
+
+
+ { __( 'Aa' ) }
+
+ { label }
+
+
+ );
+}
function ScreenTypography( { name } ) {
const parentMenu = name === undefined ? '' : '/blocks/' + name;
@@ -18,10 +75,34 @@ function ScreenTypography( { name } ) {
back={ parentMenu ? parentMenu : '/' }
title={ __( 'Typography' ) }
description={ __(
- 'Manage the fonts used on the site and the default aspect of different global elements.'
+ 'Manage the typography settings for different elements.'
) }
/>
-
+
+ { ! name && (
+
+
+ { __( 'Elements' ) }
+
+
+
+
+
+
+ ) }
+
+ { /* no typogrpahy elements support yet for blocks */ }
+ { !! name && }
>
);
}
diff --git a/packages/edit-site/src/components/global-styles/style.scss b/packages/edit-site/src/components/global-styles/style.scss
index e92d9a832f6ff..0429695eb99bd 100644
--- a/packages/edit-site/src/components/global-styles/style.scss
+++ b/packages/edit-site/src/components/global-styles/style.scss
@@ -15,6 +15,30 @@
}
}
+.edit-site-typography-panel__preview {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ min-height: 100px;
+ margin-bottom: $grid-unit-20;
+ background: $gray-100;
+ border-radius: $radius-block-ui;
+}
+
+.edit-site-global-styles-screen-typography {
+ margin: $grid-unit-20;
+}
+
+.edit-site-global-styles-screen-typography__indicator {
+ height: 24px;
+ width: 24px;
+ font-size: 14px;
+ display: flex !important;
+ align-items: center;
+ justify-content: center;
+ border-radius: $radius-block-ui;
+}
+
.edit-site-global-styles-screen-colors {
margin: $grid-unit-20;
diff --git a/packages/edit-site/src/components/global-styles/typography-panel.js b/packages/edit-site/src/components/global-styles/typography-panel.js
index 85a990ccca290..03e3634ce77d4 100644
--- a/packages/edit-site/src/components/global-styles/typography-panel.js
+++ b/packages/edit-site/src/components/global-styles/typography-panel.js
@@ -54,8 +54,10 @@ function useHasLetterSpacingControl( name ) {
);
}
-export default function TypographyPanel( { name } ) {
+export default function TypographyPanel( { name, element } ) {
const supports = getSupportedGlobalStylesPanels( name );
+ const prefix =
+ element === 'text' || ! element ? '' : `elements.${ element }.`;
const [ fontSizes ] = useSetting( 'typography.fontSizes', name );
const disableCustomFontSizes = ! useSetting(
'typography.customFontSize',
@@ -73,30 +75,58 @@ export default function TypographyPanel( { name } ) {
const hasLetterSpacingControl = useHasLetterSpacingControl( name );
const [ fontFamily, setFontFamily ] = useStyle(
- 'typography.fontFamily',
+ prefix + 'typography.fontFamily',
+ name
+ );
+ const [ fontSize, setFontSize ] = useStyle(
+ prefix + 'typography.fontSize',
name
);
- const [ fontSize, setFontSize ] = useStyle( 'typography.fontSize', name );
const [ fontStyle, setFontStyle ] = useStyle(
- 'typography.fontStyle',
+ prefix + 'typography.fontStyle',
name
);
const [ fontWeight, setFontWeight ] = useStyle(
- 'typography.fontWeight',
+ prefix + 'typography.fontWeight',
name
);
const [ lineHeight, setLineHeight ] = useStyle(
- 'typography.lineHeight',
+ prefix + 'typography.lineHeight',
name
);
const [ letterSpacing, setLetterSpacing ] = useStyle(
- 'typography.letterSpacing',
+ prefix + 'typography.letterSpacing',
name
);
+ const [ backgroundColor ] = useStyle( prefix + 'color.background', name );
+ const [ gradientValue ] = useStyle( prefix + 'color.gradient', name );
+ const [ color ] = useStyle( prefix + 'color.text', name );
+ const extraStyles =
+ element === 'link'
+ ? {
+ textDecoration: 'underline',
+ }
+ : {};
return (
+
+ Aa
+
+
{ supports.includes( 'fontFamily' ) && (
+
+
+
+
+
+
+
+