Add help icon to recent button
MAILPOET-6331
This commit is contained in:
committed by
Oluwaseun Olorunsola
parent
cb091e0dc6
commit
cec952fbde
@@ -1,15 +1,25 @@
|
|||||||
import { Button } from '@wordpress/components';
|
import { Button } from '@wordpress/components';
|
||||||
|
import { info } from '@wordpress/icons';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { TemplateCategory } from '../../store';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
selectedCategory?: TemplateCategory;
|
||||||
|
templateCategories: Array< { name: TemplateCategory; label: string } >;
|
||||||
|
onClickCategory: ( name: TemplateCategory ) => void;
|
||||||
|
};
|
||||||
|
|
||||||
export function TemplateCategoriesListSidebar( {
|
export function TemplateCategoriesListSidebar( {
|
||||||
selectedCategory,
|
selectedCategory,
|
||||||
templateCategories,
|
templateCategories,
|
||||||
onClickCategory,
|
onClickCategory,
|
||||||
} ) {
|
}: Props ) {
|
||||||
const baseClassName = 'block-editor-block-patterns-explorer__sidebar';
|
const baseClassName = 'block-editor-block-patterns-explorer__sidebar';
|
||||||
return (
|
return (
|
||||||
<div className={ baseClassName }>
|
<div className={ baseClassName }>
|
||||||
<div className={ `${ baseClassName }__categories-list` }>
|
<div className={ `${ baseClassName }__categories-list` }>
|
||||||
{ templateCategories.map( ( { name, label } ) => {
|
{ templateCategories.map( ( { name, label } ) => {
|
||||||
|
const isRecentButton = name === 'recent';
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
key={ name }
|
key={ name }
|
||||||
@@ -19,6 +29,19 @@ export function TemplateCategoriesListSidebar( {
|
|||||||
onClick={ () => {
|
onClick={ () => {
|
||||||
onClickCategory( name );
|
onClickCategory( name );
|
||||||
} }
|
} }
|
||||||
|
showTooltip={ isRecentButton }
|
||||||
|
tooltipPosition="top"
|
||||||
|
aria-label="This is some content"
|
||||||
|
icon={ isRecentButton ? info : null }
|
||||||
|
iconPosition="right"
|
||||||
|
describedBy={
|
||||||
|
isRecentButton
|
||||||
|
? __(
|
||||||
|
'Templates created on the legacy editor will not appear here',
|
||||||
|
'mailpoet'
|
||||||
|
)
|
||||||
|
: null
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{ label }
|
{ label }
|
||||||
</Button>
|
</Button>
|
||||||
|
@@ -6,8 +6,15 @@ import {
|
|||||||
} from '@wordpress/components';
|
} from '@wordpress/components';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { Async } from './async';
|
import { Async } from './async';
|
||||||
|
import { TemplateCategory, TemplatePreview } from '../../store';
|
||||||
|
|
||||||
function TemplateListBox( { templates, onTemplateSelection } ) {
|
type Props = {
|
||||||
|
templates: TemplatePreview[];
|
||||||
|
onTemplateSelection: ( template: TemplatePreview ) => void;
|
||||||
|
selectedCategory?: TemplateCategory;
|
||||||
|
};
|
||||||
|
|
||||||
|
function TemplateListBox( { templates, onTemplateSelection }: Props ) {
|
||||||
return (
|
return (
|
||||||
<div className="block-editor-block-patterns-list" role="listbox">
|
<div className="block-editor-block-patterns-list" role="listbox">
|
||||||
{ templates.map( ( template ) => (
|
{ templates.map( ( template ) => (
|
||||||
@@ -63,7 +70,7 @@ export function TemplateList( {
|
|||||||
templates,
|
templates,
|
||||||
onTemplateSelection,
|
onTemplateSelection,
|
||||||
selectedCategory,
|
selectedCategory,
|
||||||
} ) {
|
}: Props ) {
|
||||||
const filteredTemplates = useMemo(
|
const filteredTemplates = useMemo(
|
||||||
() =>
|
() =>
|
||||||
templates.filter(
|
templates.filter(
|
||||||
|
Reference in New Issue
Block a user