diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index a2810c19..929dc82e 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -501,6 +501,7 @@ "panel.seoKeywords.density": "Keyword density", "panel.seoKeywordInfo.validInfo.label": "Heading(s)", "panel.seoKeywordInfo.validInfo.content": "Content", + "panel.seoKeywordInfo.density.tooltip": "Recommended frequency: 0.75% - 1.5%", "panel.seoKeywords.title": "Keywords", "panel.seoKeywords.header.keyword": "Keyword", diff --git a/src/components/common/Tooltip.tsx b/src/components/common/Tooltip.tsx new file mode 100644 index 00000000..3ec82030 --- /dev/null +++ b/src/components/common/Tooltip.tsx @@ -0,0 +1,26 @@ +import * as React from 'react'; +import { Tooltip as TT } from 'react-tooltip' + +export interface ITooltipProps { + id: string; + render?: () => React.ReactNode; +} + +export const Tooltip: React.FunctionComponent = ({ + id, + render +}: React.PropsWithChildren) => { + + const tooltipClasses = `!py-[2px] !px-[8px] !rounded-[3px] !border-[var(--vscode-editorHoverWidget-border)] !border !border-solid !bg-[var(--vscode-editorHoverWidget-background)] !text-[var(--vscode-editorHoverWidget-foreground)] !font-normal !opacity-100 shadow-[0_2px_8px_var(--vscode-widget-shadow)] text-left`; + + return ( + + ); +}; \ No newline at end of file diff --git a/src/localization/localization.enum.ts b/src/localization/localization.enum.ts index 4173d25b..6ed2d24a 100644 --- a/src/localization/localization.enum.ts +++ b/src/localization/localization.enum.ts @@ -616,7 +616,7 @@ export enum LocalizationKey { */ dashboardHeaderPaginationPrevious = 'dashboard.header.pagination.previous', /** - * next + * Next */ dashboardHeaderPaginationNext = 'dashboard.header.pagination.next', /** @@ -1620,6 +1620,10 @@ export enum LocalizationKey { * Content */ panelSeoKeywordInfoValidInfoContent = 'panel.seoKeywordInfo.validInfo.content', + /** + * Recommended frequency: 0.75% - 1.5% + */ + panelSeoKeywordInfoDensityTooltip = 'panel.seoKeywordInfo.density.tooltip', /** * Keywords */ diff --git a/src/panelWebView/components/SeoKeywordInfo.tsx b/src/panelWebView/components/SeoKeywordInfo.tsx index 871a5e01..9434ab55 100644 --- a/src/panelWebView/components/SeoKeywordInfo.tsx +++ b/src/panelWebView/components/SeoKeywordInfo.tsx @@ -5,7 +5,7 @@ import { Tag } from './Tag'; import { LocalizationKey, localize } from '../../localization'; import { Messenger } from '@estruyf/vscode/dist/client'; import { CommandToCode } from '../CommandToCode'; -import { Tooltip } from 'react-tooltip' +import { Tooltip } from '../../components/common/Tooltip'; export interface ISeoKeywordInfoProps { keywords: string[]; @@ -29,8 +29,6 @@ const SeoKeywordInfo: React.FunctionComponent = ({ headings }: React.PropsWithChildren) => { - const tooltipClasses = `!py-[2px] !px-[8px] !rounded-[3px] !border-[var(--vscode-editorHoverWidget-border)] !border !border-solid !bg-[var(--vscode-editorHoverWidget-background)] !text-[var(--vscode-editorHoverWidget-foreground)] !font-normal !opacity-100 shadow-[0_2px_8px_var(--vscode-widget-shadow)] text-left`; - const density = () => { if (!wordCount) { return null; @@ -40,14 +38,15 @@ const SeoKeywordInfo: React.FunctionComponent = ({ const count = (content.match(pattern) || []).length; const density = (count / wordCount) * 100; const densityTitle = `${density.toFixed(2)}* %`; - - if (density < 0.75) { - return {densityTitle}; - } else if (density >= 0.75 && density < 1.5) { - return {densityTitle}; - } else { - return {densityTitle}; - } + const color = (density >= 0.75 && density < 1.5) ? "--vscode-charts-green" : "--vscode-charts-yellow"; + return ( + + {densityTitle} + + ); }; const validateKeywords = (heading: string, keyword: string) => { @@ -98,7 +97,7 @@ const SeoKeywordInfo: React.FunctionComponent = ({ const tooltipContent = React.useMemo(() => { return ( <> - Keyword present in:
+

Keyword present in:

{localize(LocalizationKey.commonTitle)}
{localize(LocalizationKey.commonDescription)}
{localize(LocalizationKey.commonSlug)}
@@ -116,7 +115,10 @@ const SeoKeywordInfo: React.FunctionComponent = ({ return (
@@ -137,7 +139,7 @@ const SeoKeywordInfo: React.FunctionComponent = ({
void 0} title={localize(LocalizationKey.panelTagsTagWarning, keyword)} @@ -150,15 +152,13 @@ const SeoKeywordInfo: React.FunctionComponent = ({ tooltipContent} /> {density()} + + ); diff --git a/src/panelWebView/components/VSCode/VSCodeTable.tsx b/src/panelWebView/components/VSCode/VSCodeTable.tsx index 7a287c5b..779e65fa 100644 --- a/src/panelWebView/components/VSCode/VSCodeTable.tsx +++ b/src/panelWebView/components/VSCode/VSCodeTable.tsx @@ -72,7 +72,7 @@ const VSCodeTableHead = React.forwardRef< = ({ return (
{isValid ? ( - + ) : ( - + )} - {label && {label}} + {label && {label}}
); }; diff --git a/src/panelWebView/styles.css b/src/panelWebView/styles.css index 355be5f5..137ebee8 100644 --- a/src/panelWebView/styles.css +++ b/src/panelWebView/styles.css @@ -895,14 +895,29 @@ vscode-divider { color: var(--vscode-inputValidation-infoForeground, #fff); } +.tag { + transition: all 100ms; +} + +.tag:has(.tag__delete:hover) { + background-color: var(--vscode-inputValidation-errorBackground); + color: var(--vscode-inputValidation-errorForeground); +} + .tag .tag__delete { margin-left: 0.25rem; + + & svg { + stroke-width: 3; + } } .tag .tag__delete:hover { - background-color: var(--vscode-inputValidation-errorBackground); color: var(--vscode-inputValidation-errorForeground, #000); - border-radius: 2px; + + & svg { + color: var(--vscode-charts-red); + } } .vscode-dark .tag .tag__delete:hover { @@ -911,7 +926,8 @@ vscode-divider { .tag .tag__value { flex-grow: 1; - white-space: nowrap; + white-space: pre-wrap; + font-weight: 600; } /* Slug field */