Skip to content

Commit

Permalink
Add tooltip to typography variations
Browse files Browse the repository at this point in the history
  • Loading branch information
amitraj2203 committed Jun 19, 2024
1 parent 9da6486 commit c017195
Showing 1 changed file with 30 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
__experimentalGrid as Grid,
__experimentalVStack as HStack,
__experimentalVStack as VStack,
Tooltip,
} from '@wordpress/components';

/**
Expand Down Expand Up @@ -35,35 +36,38 @@ export default function TypographyVariations( { title, gap = 2 } ) {
{ typographyVariations &&
typographyVariations.length &&
typographyVariations.map( ( variation, index ) => (
<Variation
key={ index }
variation={ variation }
property="typography"
>
{ ( isFocused ) => (
<PreviewIframe
label={ variation?.title }
isFocused={ isFocused }
<Tooltip key={ index } text={ variation?.title }>
<div>
<Variation
variation={ variation }
property="typography"
>
{ ( { ratio, key } ) => (
<HStack
key={ key }
spacing={ 10 * ratio }
justify="center"
style={ {
height: '100%',
overflow: 'hidden',
} }
{ ( isFocused ) => (
<PreviewIframe
label={ variation?.title }
isFocused={ isFocused }
>
<TypographyExample
variation={ variation }
fontSize={ 85 * ratio }
/>
</HStack>
{ ( { ratio, key } ) => (
<HStack
key={ key }
spacing={ 10 * ratio }
justify="center"
style={ {
height: '100%',
overflow: 'hidden',
} }
>
<TypographyExample
variation={ variation }
fontSize={ 85 * ratio }
/>
</HStack>
) }
</PreviewIframe>
) }
</PreviewIframe>
) }
</Variation>
</Variation>
</div>
</Tooltip>
) ) }
</Grid>
</VStack>
Expand Down

0 comments on commit c017195

Please sign in to comment.