Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: use official WordPress components
Elijah Potterd0aa0c6c4437
diff --git a/package.json b/package.jsonindex 3795bc725..e68e156f7 100644--- a/package.json+++ b/package.json@@ -20,6 +20,7 @@},"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e","dependencies": {+ "@wordpress/components": "^29.2.0","@wordpress/data": "^10.15.1","@wordpress/edit-post": "^8.16.0","@wordpress/editor": "^14.16.0",diff --git a/src/harper/SuggestionControl.tsx b/src/harper/SuggestionControl.tsxindex 54cc3d3f1..ca4c3f7b2 100644--- a/src/harper/SuggestionControl.tsx+++ b/src/harper/SuggestionControl.tsx@@ -1,6 +1,7 @@import React, { useEffect, useMemo, useRef, useState } from 'react';import { isPointInBox, LintBox } from './Box';import { SuggestionKind } from 'harper.js';+import { Button, Popover } from '@wordpress/components';function suggestionText(kind: SuggestionKind,@@ -80,35 +81,29 @@ export default function SuggestionControl({ lintBox }: { lintBox: LintBox }) {}}></div>{showPopover ? (- <div+ <Popoverref={popoverRef}+ anchor={underlineRef.current}className="harper-popover"- style={{- position: 'absolute',- top: `${y + height + 4}px`,- left: ` ${x}px`,- zIndex: 100,- }}>- <h1 className={`harper-underline-${lint.lint_kind()}`}>+ <h2 className={`harper-underline-${lint.lint_kind()}`}>{lint.lint_kind()}- </h1>-+ </h2><p>{lint.message()}</p>-{suggestions.map((sug, index) => (- <button+ <Buttonkey={index}onClick={() => applySuggestion(sug)}+ variant="primary">{suggestionText(sug.kind(),lint.get_problem_text(),sug.get_replacement_text())}- </button>+ </Button>))}- </div>+ </Popover>) : (<></>)}diff --git a/src/harper/index.css b/src/harper/index.cssindex 94d5ceef7..04aa0772c 100644--- a/src/harper/index.css+++ b/src/harper/index.css@@ -1,39 +1,12 @@-.harper-popover {- border-radius: 4px;- border: 1px solid black;- padding: 8px;- background-color: white;- font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;- filter: drop-shadow(5px 5px 5px #CCCCCC);+.harper-popover > div {width: 200px;- display: flex;- flex-direction: column;- align-items: left;- text-align: left;+ z-index: 100;+ padding: 10px;}-.harper-popover > h1 {- font-size: 16px;- font-weight: 750;-}--.harper-popover > p {- font-size: 14px;- font-weight: 500;-}--.harper-popover > button {+.harper-popover > div > button {width: 100%;- padding: 8px;- margin-top: 8px;- border-radius: 8px;- border: 0px;- font-size: 14px;- font-weight: 750px;-}--.harper-popover > button:hover {- filter: brightness(0.9);+ margin-top: 6px;}.harper-underline-Spelling {