Commit 610dd6a9 authored by Semmy's avatar Semmy
Browse files

fix: high light block menu

No related merge requests found
Showing with 13 additions and 3 deletions
+13 -3
import { LayoutOutlined } from '@ant-design/icons';
import React from 'react';
import { useSetState } from 'ahooks';
import React, { useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
import { useHistory, useLocation } from 'react-router-dom';
import { PluginManager } from '../plugin-manager';
export const SchemaTemplateShortcut = () => {
const { t } = useTranslation();
const location = useLocation();
const [style, setStyle] = useSetState({});
const pathname = '/admin/block-templates';
useEffect(() => {
setStyle(location.pathname.startsWith(pathname) ? { backgroundColor: '#f18b62' } : { backgroundColor: null });
}, [location.pathname]);
const history = useHistory();
return (
<PluginManager.Toolbar.Item
style={style}
icon={<LayoutOutlined />}
title={t('Block templates')}
onClick={() => {
history.push('/admin/block-templates');
history.push(pathname);
}}
/>
);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment