From 028fd49899a8f50b41211ef3692ffbd73328df63 Mon Sep 17 00:00:00 2001 From: myslaf Date: Wed, 4 Oct 2023 11:57:42 +0200 Subject: [PATCH] Add hideActionButtons prop to H5Player to hide actions buttons of h5p. --- src/components/players/H5Player/H5Player.md | 1 + src/components/players/H5Player/H5Player.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/players/H5Player/H5Player.md b/src/components/players/H5Player/H5Player.md index 28b1dfdb..79d0cf44 100644 --- a/src/components/players/H5Player/H5Player.md +++ b/src/components/players/H5Player/H5Player.md @@ -146,6 +146,7 @@ useEffect(() => { key={uuid} onXAPI={(e) => console.log("onXAPI ", e)} onTopicEnd={() => console.log("H5P progress")} + hideActionButtons {...playerProps} /> diff --git a/src/components/players/H5Player/H5Player.tsx b/src/components/players/H5Player/H5Player.tsx index 29b04d28..3e8ee85b 100644 --- a/src/components/players/H5Player/H5Player.tsx +++ b/src/components/players/H5Player/H5Player.tsx @@ -22,6 +22,7 @@ export interface H5PProps extends ExtendableStyledComponent { overwriteFileName?: string; h5pObject?: API.H5PObject; onTopicEnd?: () => void; + hideActionButtons?: boolean; } export const H5Player: React.FC = ({ @@ -32,6 +33,7 @@ export const H5Player: React.FC = ({ h5pObject, loading = false, className = "", + hideActionButtons, }) => { const { fetchH5P, h5p } = useContext(EscolaLMSContext); @@ -530,9 +532,12 @@ export const H5Player: React.FC = ({ themeContext.primaryColor )}!important; } + .h5p-content ul.h5p-actions { + display: ${hideActionButtons ? 'none' : 'block'}; + } `; return `data:text/css;base64,${btoa(css)}`; - }, [themeContext]); + }, [themeContext, hideActionButtons]); return (