ability to hide title

This commit is contained in:
lingdocs 2022-09-17 21:42:30 +04:00
parent 383902b3b2
commit 2c41595b98
2 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "3.9.5", "version": "3.9.6",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "homepage": "https://verbs.lingdocs.com",

View File

@ -36,9 +36,10 @@ const explanation = (inf: T.Inflections | T.PluralInflections, textOptions: T.Te
</>; </>;
} }
const InflectionTable = ({ inf, textOptions }: { const InflectionTable = ({ inf, textOptions, hideTitle }: {
inf: T.Inflections | T.PluralInflections, inf: T.Inflections | T.PluralInflections,
textOptions: T.TextOptions, textOptions: T.TextOptions,
hideTitle?: boolean,
}) => { }) => {
const [showingExplanation, setShowingExplanation] = useState(false); const [showingExplanation, setShowingExplanation] = useState(false);
/* istanbul ignore next */ // Insanely can't see the modal to close it /* istanbul ignore next */ // Insanely can't see the modal to close it
@ -46,13 +47,13 @@ const InflectionTable = ({ inf, textOptions }: {
const handleShowExplanation = () => setShowingExplanation(true); const handleShowExplanation = () => setShowingExplanation(true);
const isPluralInfs = isPluralInflections(inf); const isPluralInfs = isPluralInflections(inf);
return ( return (
<div className="mt-4"> <div className={!hideTitle ? "" : "mt-4"}>
<div style={{ display: "flex", justifyContent: !isPluralInfs ? "space-between" : "left" }}> {!hideTitle && <div style={{ display: "flex", justifyContent: !isPluralInfs ? "space-between" : "left" }}>
{!isPluralInfs && <h5>Inflections</h5>} {!isPluralInfs && <h5>Inflections</h5>}
{!isPluralInfs && <div className="clickable mr-2" onClick={handleShowExplanation} data-testid="help-button"> {!isPluralInfs && <div className="clickable mr-2" onClick={handleShowExplanation} data-testid="help-button">
<i className={`fa fa-question-circle`}></i> <i className={`fa fa-question-circle`}></i>
</div>} </div>}
</div> </div>}
<table className="table" style={{ tableLayout: "fixed" }}> <table className="table" style={{ tableLayout: "fixed" }}>
<thead> <thead>
<tr> <tr>
@ -71,7 +72,7 @@ const InflectionTable = ({ inf, textOptions }: {
))} ))}
</tbody> </tbody>
</table> </table>
{!isPluralInfs && <Modal show={showingExplanation} onHide={handleCloseExplanation}> {(!hideTitle && !isPluralInfs) && <Modal show={showingExplanation} onHide={handleCloseExplanation}>
<Modal.Header closeButton> <Modal.Header closeButton>
<Modal.Title>About {isPluralInfs ? "Inflections" : "Arabic Plural"}</Modal.Title> <Modal.Title>About {isPluralInfs ? "Inflections" : "Arabic Plural"}</Modal.Title>
</Modal.Header> </Modal.Header>