Skip to content

Commit

Permalink
feat: Display VLibras widget only on content pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericof committed Aug 8, 2022
1 parent 361d3db commit 2104d0d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/Libras.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useEffect, useState } from 'react';
import { isCmsUi } from '@plone/volto/helpers';

const widgetSrc = 'https://vlibras.gov.br/app';
const scriptId = 'VLibras';
Expand Down Expand Up @@ -35,8 +36,8 @@ const Libras = (props) => {
}, [loaded]);

useEffect(() => {
const re = /\/(add|edit|login|logout)/;
if (re.exec(pathName)) {
// Disable widget on non content routes
if (isCmsUi(pathName)) {
setStatus('disabled');
} else {
setStatus('enabled');
Expand Down

0 comments on commit 2104d0d

Please sign in to comment.