diff --git a/src/components/GlossaryCard.js b/src/components/GlossaryCard.js index 344452235..a5b58f987 100644 --- a/src/components/GlossaryCard.js +++ b/src/components/GlossaryCard.js @@ -1,26 +1,60 @@ -import React from "react"; +import React, { useState } from "react"; import ArrowUpRight from "../../static/img/ArrowUpRight.svg"; -const GlossaryCard = ({name, description, link}) => { +const GlossaryCard = ({ name, description, link }) => { + const [open, setOpen] = useState(false); + return ( - -
-

- {name} -

- + <> +
setOpen(true)} + onKeyPress={e => (e.key === 'Enter' || e.key === ' ') && setOpen(true)} + className="group flex h-full flex-col rounded-xl border border-transparent bg-[var(--ifm-card-background-color)] p-6 shadow-[0_4px_12px_var(--ifm-card-shadow-color)] transition-all duration-300 hover:border-[var(--ifm-color-primary)] hover:shadow-[0_8px_20px_var(--ifm-card-shadow-color)] focus:outline-none focus:ring-2 focus:ring-[var(--ifm-color-primary)] focus:ring-offset-2 cursor-pointer" + aria-label={`Show definition for ${name}`} + > +
+

+ {name} +

+ +
+

+ {description} +

-

- {description} -

-
+ {open && ( +
setOpen(false)}> +
e.stopPropagation()} + > + +

{name}

+

{description}

+ + Read more + + +
+
+ )} + ); }; diff --git a/static/data/glossaryEntries.js b/static/data/glossaryEntries.js index 45c1f396d..4da3c93d8 100644 --- a/static/data/glossaryEntries.js +++ b/static/data/glossaryEntries.js @@ -104,13 +104,13 @@ export const glossaryEntries = { { name: "Regression Testing", link: "/docs/concepts/reference/glossary/regression-testing", - description: "Ensures new code doesn’t break old features.", + description: "Ensures new code doesn't break old features.", }, ], S: [ { name: "Stubs", - ink: "/docs/concepts/reference/glossary/stubs", + link: "/docs/concepts/reference/glossary/stubs", description: "Simulates methods or APIs during testing.", }, {