Skip to content

Commit

Permalink
Add hideActionButtons prop to H5Player to hide actions buttons of h5p.
Browse files Browse the repository at this point in the history
  • Loading branch information
myslaf committed Oct 4, 2023
1 parent 409e6db commit 028fd49
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/players/H5Player/H5Player.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ useEffect(() => {
key={uuid}
onXAPI={(e) => console.log("onXAPI ", e)}
onTopicEnd={() => console.log("H5P progress")}
hideActionButtons
{...playerProps}
/>
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/components/players/H5Player/H5Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface H5PProps extends ExtendableStyledComponent {
overwriteFileName?: string;
h5pObject?: API.H5PObject;
onTopicEnd?: () => void;
hideActionButtons?: boolean;
}

export const H5Player: React.FC<H5PProps> = ({
Expand All @@ -32,6 +33,7 @@ export const H5Player: React.FC<H5PProps> = ({
h5pObject,
loading = false,
className = "",
hideActionButtons,
}) => {
const { fetchH5P, h5p } = useContext(EscolaLMSContext);

Expand Down Expand Up @@ -530,9 +532,12 @@ export const H5Player: React.FC<H5PProps> = ({
themeContext.primaryColor
)}!important;
}
.h5p-content ul.h5p-actions {
display: ${hideActionButtons ? 'none' : 'block'};
}
`;
return `data:text/css;base64,${btoa(css)}`;
}, [themeContext]);
}, [themeContext, hideActionButtons]);

return (
<StyledH5P className={`wellms-component ${className}`}>
Expand Down

0 comments on commit 028fd49

Please sign in to comment.