-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Global Styles: Make a shared component for typography and color previ…
…ew (#62829) * Global Styles: Make a shared component for typography and color preview * remove null check that has already happened Co-authored-by: scruffian <scruffian@git.wordpress.org> Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org> Co-authored-by: jeryj <jeryj@git.wordpress.org>
- Loading branch information
1 parent
63f0cc8
commit 352f568
Showing
2 changed files
with
48 additions
and
30 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
packages/edit-site/src/components/global-styles/preview-typography.js
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __experimentalHStack as HStack } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import TypographyExample from './typography-example'; | ||
import PreviewIframe from './preview-iframe'; | ||
|
||
const StylesPreviewTypography = ( { variation, isFocused, withHoverView } ) => { | ||
return ( | ||
<PreviewIframe | ||
label={ variation.title } | ||
isFocused={ isFocused } | ||
withHoverView={ withHoverView } | ||
> | ||
{ ( { ratio, key } ) => ( | ||
<HStack | ||
key={ key } | ||
spacing={ 10 * ratio } | ||
justify="center" | ||
style={ { | ||
height: '100%', | ||
overflow: 'hidden', | ||
} } | ||
> | ||
<TypographyExample | ||
variation={ variation } | ||
fontSize={ 85 * ratio } | ||
/> | ||
</HStack> | ||
) } | ||
</PreviewIframe> | ||
); | ||
}; | ||
|
||
export default StylesPreviewTypography; |
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