Skip to content

Commit

Permalink
Make title clickable (#52599)
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave authored Jul 13, 2023
1 parent fa086e5 commit 899a719
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/edit-site/src/components/page-patterns/grid-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
__unstableCompositeItem as CompositeItem,
Tooltip,
Flex,
Button,
} from '@wordpress/components';
import { useDispatch } from '@wordpress/data';
import { useState, useId } from '@wordpress/element';
Expand Down Expand Up @@ -160,7 +161,19 @@ export default function GridItem( { categoryId, composite, icon, item } ) {
/>
) }
<Flex as="span" gap={ 0 } justify="left">
{ item.title }
{ item.type === PATTERNS ? (
item.title
) : (
<Button
variant="link"
onClick={ onClick }
// Required for the grid's roving tab index system.
// See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.
tabIndex="-1"
>
{ item.title }
</Button>
) }
{ item.type === PATTERNS && (
<Tooltip
position="top center"
Expand Down
10 changes: 10 additions & 0 deletions packages/edit-site/src/components/page-patterns/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@
.edit-site-patterns__pattern-title {
color: $gray-200;

.is-link {
text-decoration: none;
color: $gray-200;

&:hover,
&:focus {
color: $white;
}
}

.edit-site-patterns__pattern-icon {
border-radius: $grid-unit-05;
background: var(--wp-block-synced-color);
Expand Down

0 comments on commit 899a719

Please sign in to comment.